s12_while_to_for.cpp
1 week ago in C
#include <stdio.h>

main() {

// --- ÖNCESİ ---

int x = 1;
int y;

while (x <= 10)
{
y = x * x;
printf("%d %d\n", x, y);
x += 3;
}
*/


// --- SONRASI ---

int y;

for (int x=1; x <= 10; x+=3)
{
y = x * x;
printf("%d %d\n", x, y);
}

}

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31