Monday, July 27, 2009

Help i made this program i need it too loop about 25 time but i dont know how to us loops in tubo c?

#include%26lt;stdio.h%26gt;


int grade;





main()


{


int count =1


clrscr();


printf("Input Grade; ");


scanf("%d",%26amp;grade);


{


if(grade%26gt;=90)


printf("Excellenn");





else if (grade%26gt;=75)


printf


("Fair");





else


printf("Failed");


}


getch();


}





this is the program in turbo c not c++, it ask students about there grade and tells them if they past or fail, this program must loop for 25 student pls show me how to make it loop 25 time and where should i put the syntx to make it loop pls help me.

Help i made this program i need it too loop about 25 time but i dont know how to us loops in tubo c?
here is ur code with loop fr 25 times.. happy?


#include%26lt;stdio.h%26gt;


int grade;





main()


{


int count =1,i; /* declration for loop variable*/


clrscr();





for(i=0;i%26lt;25;i++) /* "for loop" begins here */


{





printf("Input Grade; ");


scanf("%d",%26amp;grade);


{


if(grade%26gt;=90)


printf("Excellenn");





else if (grade%26gt;=75)


printf


("Fair");





else


printf("Failed");


}





} /* end loop here*/


getch();


}
Reply:Try the while statement:








clrscr();


while (count %26lt; 26)


{


printf("Input Grade; ");


.


.


.


printf("Failed");


}


count++;


}


getch();
Reply:Start your loop after clrscr() %26amp; end the loop block before getch()
Reply:#include%26lt;stdio.h%26gt;


int grade;





main()


{


int count =1


clrscr();


printf("Input Grade; ");


scanf("%d",%26amp;grade);


for(count=1;count%26lt;=25;count++)


{


if(grade%26gt;=90)


printf("Excellent");





else if (grade%26gt;=75)


printf


("Fair");





else


printf("Failed");


}


getch();


}


No comments:

Post a Comment