Computer Science, asked by chinmay17, 1 year ago

give me a programme on nested if


anuj: was it for c++ OR JAVA
ajayaj: i have written in C
anuj: U WANTED QUESTION OR AN EXAMPLE OF NESTED IF
ajayaj: i mean i have answered in C language
anuj: Oh!! i thought u were the questioner
anuj: i thought that he wanted a question on it

Answers

Answered by anuj
1
heya friend,

Nested is kind of confusing but  not that much tough when once we learn to write the program
there can be many programs related to it 


WAP to check whether the entered year is a leap year or not?
[Leap Years are any year that can be evenly divided by 4.  A year that is evenly divisible by 100 is a leap year only if it is also evenly divisible by 400.]

hope it helped!!


Answered by ajayaj
1
suppose u want to write a C language program such tht if input no. is positive or not if it is positive it is even or not

#include <stdio.h>
int main( )
{
int x;
scanf("%d",&x);
if(x>0)
{
printf("it is positive no.");
if(x%2==0)
{
printf("it is even positive no.");
}
}
return 0;
}
Similar questions