WA P to check whether the number entered is even or odd / WAP to check whether the year entered is leap year or not
//WAP to check whether the number entered is even or odd//
#include<stdio.h>
#include<conio.h>
void main()
{
int n;
printf("Enter the number to be checked\n");
scanf("%d", &n);
if (n%2==0)
{
printf("Entered number is Even\n");
}
else
{
printf("Entered number is Odd\n");
}
getch();
}
#include<stdio.h>
#include<conio.h>
void main()
{
int n;
printf("Enter the number to be checked\n");
scanf("%d", &n);
if (n%2==0)
{
printf("Entered number is Even\n");
}
else
{
printf("Entered number is Odd\n");
}
getch();
}
- The Input and Output of this program is shown in the pictures below:- INPUT
OUTPUT
//WAP to check whether the year entered is leap year or not// #include<stdio.h> #include<conio.h> void main() { int n; printf("Enter the year to be checked\n"); scanf("%d", &n); if (n%4==0) { printf("Entered year is a leap year\n"); } else { printf("Entered year is not a leap year\n"); } getch(); } - The Input and Output of this program is shown in the picture below:- INPUT
OUTPUT






Comments
Post a Comment