PREDICT THE OUTPUT FOR THE FOLLOWING PROGRAM SNIPPET:
( 3X1=3)
6. int x=8;
if (x%2 ==0)
{
printf(“%d is Even”,x);
}
else
{
printf(“%d is Odd”,x);
}
Answers
Answered by
0
Question:-
Write the output of following code snippet.
Solution:-
Given code,
int x=8;
if (x%2 ==0)
{
printf("%d is Even”,x);
}
else
printf(“%d is Odd”,x);
Here,
x%2=8%2=0
So,
x%2==0
if block will execute.
So,
Output:-
8 is even.
Output:-
8 is even.
Similar questions