12.0k views
23 votes
Write a c program using loops to generate following output.

12 x 2 = 24
11 x 2 = 22
10 x 2 = 20
9 x 2 = 18
8 x 2 = 16
7 x 2 = 14
6 x 2 = 12
5 x 2 = 10
4 x 2 = 8
3 x 2 = 6
2 x 2 = 4
1 x 2 = 2

User Yecenia
by
4.1k points

1 Answer

7 votes

Answer:

#include <stdio.h>

int main()

{

for (int n = 12; n > 0; n--) {

printf("%d x 2 = %d\\", n, n * 2);

}

}

Step-by-step explanation:

Only one loop.

User Alex Polkhovsky
by
4.5k points