Ask your own question, for FREE!
Computer Science 22 Online
OpenStudy (anonymous):

int main() { int n; printf("n="); scanf("%lf",n); for(i=0;;i++); if(i=10)break; printf("%d",i,i*i); return 0; } can someone help me correct this code. tried countless times but failed :(

OpenStudy (anonymous):

Hi obey_bris, So let me see if I saw the picture... You need to create a loop to print n from 0 to 10, is that correct?

OpenStudy (anonymous):

ok. let me try that! but i think the break in there demands i create a switch expression!

OpenStudy (anonymous):

Isnt your for loop supposed to be more like: for(i=0; i<=10; i++) { }

OpenStudy (anonymous):

for ( variable initialization; condition; variable update ) { Code to execute while the condition is true }

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!