Using 3 different loops to display the following list 1 Numb

Using 3 different loops to display the following list: 1. Numbers from 80 to 90 in descending order (Hint: does not increment by one) 90 88 86 84 82 80 2. List of odd numbers from 1 to 20 1 3 5 7 9 11 15 17 3. Cubes of numbers from 1 to 5 1 8 27 64 125

Solution

1)

#include <stdio.h>
int main ()

{

/* local variable definition */

int a = 90;

/* do loop execution */
do {
printf(\"value of a: %d\ \", a);
a = a -2;
}while( a >= 80 );

return 0;
}

2)

#include <stdio.h>

int main () {

/* local variable definition */
int a = 1;

/* do loop execution */
do {
printf(\"value of a: %d\ \", a);
a = a +2;
}while( a%2!=0 && a<20 );

return 0;
}

3)

#include <stdio.h>

int main () {

/* local variable definition */
int a = 1;

/* do loop execution */
do {
printf(\"value of a: %d\ \", a*a*a);
a = a +1;
}while( a<519 );

return 0;
}

Using 3 different loops to display the following list: 1. Numbers from 80 to 90 in descending order (Hint: does not increment by one) 90 88 86 84 82 80 2. List

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site