0

Wap to Print 1,2,4,7,11,16 using while loop in c

We have to print the above program using while loop only

8th Aug 2019, 8:09 AM
prayaag babu
prayaag babu - avatar
2 odpowiedzi
+ 5
#include <stdio.h> #include <stdlib.h> #define LOOPS 10 int main() { int loops = 0, acc = 1; while(loops < LOOPS) { printf("%d ", acc += loops++); } return EXIT_SUCCESS; } /* IF YOU SUBMIT IT AS HOMEWORK IM GONNA TELL TO YOUR TEACHER!! */
8th Aug 2019, 8:54 AM
Valen.H. ~
Valen.H. ~ - avatar
0
Show your attempt? Pattern is +1, +2, +3 etc
8th Aug 2019, 8:16 AM
Trigger
Trigger - avatar