if else
#include<stdio.h>
int main()
{
int grade;
printf( "Enter your mark: " );
scanf("%d", &grade );
if ( grade>= 60 )
printf( "\nPass\n" );
else
printf( "\nFail\n" );
system ( "pause" );
return 0;
}
Output |
conditional operator ( :? )
#include<stdio.h>
int main()
{
int grade;
printf( "Enter your mark: " );
scanf("%d", &grade );
grade >= 60? printf( "Pass\n" ) : printf( "Fail\n" );
system ( "pause" );
return 0;
}
======================================================================
#include<stdio.h>
int main()
{
int grade;
printf( "Enter your mark: " );
scanf("%d", &grade );
printf( "%s", grade>=60? "Pass\n" : "Fail\n");
system ( "pause" );
return 0;
}
No comments:
Post a Comment