If Statements -...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
/* This program demonstrates if statements */ #include <stdio.h> void main() { int test; printf("Enter your test score "); scanf("%d",&test); printf("Great\n"); printf("Ok\n"); printf("Passable\n"); printf("Stupid\n"); if(test <0 || test >100)
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: printf(&quot;Invalid\n&quot;); /* Nested if example if(test&lt;0 || test&gt;100) printf(&quot;Invalid\n&quot;); else if(test&gt;=90) printf(&quot;Great\n&quot;); else if(test&gt;=70) printf(&quot;Ok\n&quot;); else if(test&gt;=50) printf(&quot;Passable\n&quot;); else printf(&quot;Stupid\n&quot;); */ } /* Enter your test score 90 Great Press any key to continue . . . */...
View Full Document

Ask a homework question - tutors are online