1. Write a Program to Take input from user print number is even or odd in C program .
2. Write a Program to Take input from user print year is leap year or not in C program .
3. write a Program To take input from user identify you can give a vote or not if your age under 18 to print your age under 18 in c program.
1.
Write a Program to Take input from user print number is even or odd in C program. - Program code.
/* Write a Program To take input from user
print number is even or odd */
#include<stdio.h>
#include<conio.h>
void main()
{
int n;
clrscr();
printf("Enter the number n :");
scanf("%d",&n);
if(n%2)
printf("%d is even");
else
printf("%d is odd");
getch();
}
PROGRAM :-
2.
Write a Program to Take input from user print year is leap year or not in C program - Program code.
/* Write a program to take input from
user print year is leap year or not
#include<stdio.h>
#include<conio.h>
void main()
{
int y;
clrscr();
printf("Entr year :");
scanf("%d",&y);
if(y%4==0)
printf("%d year is leap year",y);
else
printf("%d year is not leap year",y);
getch();
}
OUTPUT :-
Source code - Download Program code
3.
write a Program To take input from user identify you can give a vote or not if your age under 18 to print your age under 18 in c program. - Program code .
/* Program to identify you can give a vote or not.
if your are under 18 to print you age under 18 */
#include<stdio.h>
#include<conio.h>
void main()
{
int age;
clrscr();
printf("Enter your age : ");
scanf("%d",&age);
if(age<18 && age>=0){
printf("Your age under 18\n");
printf("please apply after 18 year");
}
else if(age<0 || age>130){
printf("Your age incorrect \n");
printf("Please enter correct age");
}
else
printf("You can give vote");
getch();
}
PROGRAM :-
0 Comments
If You have any query, Please let me know..