Solution with out using functions
Solution using functions without passing arguments
Solution using functions and by passing arguments
Solution : Without using function
Program/Source Code
#include <stdio.h>
int main()
{
int n;
printf("Enter any no ");
scanf("%d",&n);
if(n%2==1) //or if(n%2!=0)
printf("Number is Odd");
else
printf("Number is not Odd");
return 0;
}
Output:
case :1
Enter any no 57
Number is Odd
case :2
Enter any no 38
Number is not Odd
Solution : Using function Without Passing Arguments
Program/Source Code
#include <stdio.h>
void check()
{
int n;
printf("Enter any no ");
scanf("%d",&n);
if(n%2==1) //or if(n%2!=0)
printf("Number is Odd");
else
printf("Number is not Odd");
}
int main()
{
check();
return 0;
}
Output:
case:1
Enter any no 25
Number is Odd
case:2
Enter any no 36
Number is not Odd
Solution : Using function Passing Arguments
Program/Source Code
#include <stdio.h>
void check(int n)
{
if(n%2==1) //or if(n%2!=0)
printf("Number is Odd");
else
printf("Number is not Odd");
}
int main()
{
int n;
printf("Enter any no ");
scanf("%d",&n);
check(n);
return 0;
}
Output:
case :1
Enter any no 49
Number is Odd
case :2
Enter any no 44
Number is not Odd
Previous Program : Number is even or not If Condition Home Next Program : Number is multiple of 7 or not
|
Previous:
Next: |
Tutorials | Technical Questions | Interview Questions |
|---|---|---|
|
C Programming C++ Programming Class 11 (Python) Class 12 (Python) |
C Language C++ Programming Python |
C Interview Questions C++ Interview Questions C Programs C++ Programs |




