I am having difficulty with a question The question is Writ

I am having difficulty with a question. The question is .

Write a for loop that prints all the even integers from 80 through 20 inclusive, separated by spaces.

I am typing in whats below, but it isn\'t working. Please help.

int x;

for(x = 80; x> 19; x-=2)

printf (\"%d\", x);

Solution

Answer:

Add the below line along with the written code i.e

printf(\' \');

After addition of this line we get the code as below :

int x;

for(x = 80; x> 19; x-=2)

printf (\"%d\", x);

printf(\' \');

Output:

80 78 76 74 72 70 68 66 64 62 60 58 56 54 52 50 48 46 44 42 40 38 36 34 32 30 28 26 24 22 20

I am having difficulty with a question. The question is . Write a for loop that prints all the even integers from 80 through 20 inclusive, separated by spaces.

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site