May 19, 2023
program to use a number even or odd in c language
#include<stdio.h>
int main()
{
int num;
printf("Enter a number : ");
scanf("%d",&num);
if(num%2 == 0)
printf("Number is even\n");
else
{
printf("Number is odd\n");
num*=2;
printf("Now the number is %d\n",num);
}
return 0;
}
output
Enter a number : 24
Number is even
Steps Description
- declare integer variable
num
printf
inbuild function to display enter variable a number- The value you will put in
scanf
- going into the is statement will divide by 2
printf
inbuild function to display is divide by two theneven
program to use a number even or odd is c longuage
#include<stdio.h>
int main()
{
int num;
printf("Enter a number : ");
scanf("%d",&num);
if(num%2 == 0)
printf("Number is even\n");
else
{
printf("Number is odd\n");
num*=2;
printf("Now the number is %d\n",num);
}
return 0;
}
output
Enter a number : 13
Number is odd
Now the number is 26
Steps Description
- Declare integer variable num
- printf inbuild function to display enter variable a number
- The value you will put in scanf
by : Ajaj Khan
Quick Summary:
in this program it is happening even and odd number are coming out