C Programming :: Basic Concepts - Discussion
Home > C Programming > Basic Concepts > MCQs Questions Discussion
8 / 90
What is the output of the following C Program?
#include<stdio.h>
void main()
{
int y;
scanf("%d",&y); // Given Input is 2000
if( (y%4==0 && y%100 != 0) || y%100 == 0 )
printf("%d is a leap year");
else
printf("%d is not a leap year");
}
#include<stdio.h>
void main()
{
int y;
scanf("%d",&y); // Given Input is 2000
if( (y%4==0 && y%100 != 0) || y%100 == 0 )
printf("%d is a leap year");
else
printf("%d is not a leap year");
}
A2000 is not a leap year
B2000 is a leap year
CCompilation Error
DNone of these
Answer: Option (Login/Signup)
Show Explanation
Asked In ::
STEP-BY-STEP
Here, in the if block the condition (y%100)==0 is True, which is enough to execute the if block.
Therefore, the output is 2000 is a leap year.
Read Full Answer
Report Error
Please Login First Click Here
TRICK
It is just a simple leap year program , when if condition is evaluated it returns true value. So, "2000 is a leap year" get printed.
Read Full Answer
Report Error
Please Login First Click Here