1.write a program input a number then print that number is even or odd.
#include<stdio.h>
#include<conio.h>
void main()
{
int no;
clrscr( );
printf("enter a number");
scanf("%d",&no);
if(no%2==0)
{
printf("no is even");
}
else
{
printf(" no is odd");
}
}
2.write a program input a number then print that number is positive or negative;.
#include<stdio.h>
#include<conio.h>
void main()
{
int no;
clrscr( );
printf("enter a number");
scanf("%d",&no);
if(no>0)
{
printf("no is positive");
}
else
{
printf(" no is negative");
}
}
3.write a program input two numbers then print biggest one.
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,;
clrscr( );
printf("enter two number");
scanf("%d%d",&a,&b);
if(a>b)
{
printf("a is biggest");
}
else
{
printf(" b is biggest");
}
}
4.write a program input a positive number then print that number single or multi digit.
#include<stdio.h>
#include<conio.h>
void main()
{
int no;
clrscr( );
printf("enter a number");
scanf("%d",&no);
if(no<=9)
{
printf("no is single digit ");
}
else
{
printf(" no is multi digit");
}
}
5.write a program enter age of a person then print eligible for vote or not?
#include<stdio.h>
#include<conio.h>
void main()
{
int age;
clrscr( );
printf("enter age of a person");
scanf("%d",&age);
if(age>=18)
{
printf("eligible for vote ");
}
else
{
printf("not eligible for vote");
}
}
No comments:
Post a Comment