if(Condition) { if(condition) { statement 1 statement 2 } else { statement 3 statement 4 } } else { statement 5 statement 6 }
#include <stdio.h> int main() { int x; printf("Enter x value "); scanf("%d",&x); if(x>0) { if(x%2==0) { printf("%d is Even Number",x); } else { printf("%d is Odd Number %d",x); } } else { printf("Please Enter Positive Number"); } return 0; }
Enter x value 10
10 is Even Number
Enter x value 11
11 is Odd Number
Enter x value -24
Please Enter Positive Number