Home
Mega Menu
FYBCS
_C
_HTML & CSS
SYBCS
_DS
_SCILAB
TYBCS
_JAVA
_PHP
Download Apk
Home
c
C Program - Write a program to accept an integer n and display all even numbers upto n
C Program - Write a program to accept an integer n and display all even numbers upto n
prozone
June 07, 2018
Program
#include<stdio.h>
int main()
{
int n,j=1;
printf("enter nth value:");
scanf("%d",&n);
n++;
while(n!=j)
{
if(j%2==0)
{
printf("%d\t",j);
}
j++;
}
}
Output:
enter nth value:12
2 4 6 8 10 12
Post a Comment
0 Comments
Popular Posts
C Program - Write a function, which accepts a character and integer n as parameter and displays the next n characters
June 14, 2018
C Program - Write a program to add and multiply two matrices. Write separate functions to accept, display, add and multiply the matrices. Perform necessary checks before adding and multiplying the matrices
June 15, 2018
C Program - Write a function that accepts a character as parameter and returns 1 if it is an alphabet, 2 if it is a digit and 3 if it is a special symbol. In main, accept characters till the user enters EOF and use the function to count the total number of alphabets, digits and special symbols entered
June 14, 2018
Follow Us
Tags
Powered by Blogger
0 Comments