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 program, which accepts two integers and an operator as a character (+ - * /), performs the corresponding operation and displays the result
June 07, 2018
C Program - Write a program to accept two integers x and n and compute x^n
June 07, 2018
C Program - The basic salary of an employee is decided at the time of employment, which may be different for different employees. Apart from basic employee gets 10% of basic as house rent, 30& basic as dearness allowance. A professional tax 5% of basic is deducted from salary. Accept the employee id and basic salary for an employee and output the take home salary of the employee
June 01, 2018
Follow Us
Tags
Powered by Blogger
0 Comments