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
2 Respostas
+ 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!! */
0
Show your attempt?
Pattern is +1, +2, +3 etc