Thursday 21 August 2014

What would be the output of the following Program?



#include<stdio.h>
#include<conio.h>
void main( )
{
           int i;
           i = 999;
           if(i = 5)
           {
                    printf("You are Good");
           }
           else
           {
                    printf("You are Perfect");
           }
}

Options:
A)You are Perfect
B)You are Good
C)an error
D)none


Answer Option B)
Because i=5 is true statement
The purpose of the if statement is , if the condition is true then if block executed. Otherwise else block executed.




0 comments:

Post a Comment