Use loop structures below to print the even numbers 2 to 100

Use loop structures below to print the even numbers 2 to 100. (2, 4, 6, 8, 10, etc) Each program will have the same output. Write a C++ programs that print the same output as that program, but do it in the following ways: Using a for loop that increments the loop control variable by 2 each iteration Using a for loop whose loop control variable goes from 0 to 50. Using a for loop whose loop control variable goes from 100 down to 0. Using an infinite for loop with no conditional expression and exiting the loop with a break statement. Using a while loop. Using a do-while loop. There should be 6 different Snipping photos. One photo for each program A - F. Write a C++ program that directs a cashier how to give change. The program has two inputs: The amount due and the amount received from the customer. Display the dollars, quarters, dimes, nickels, and pennies that the customer should receive. Create a C++ program that uses a switch statement and case statements to calculate the number of days in any given month based upon a users input. February is a unique month. Prompt the user again to input the year if the user wants the number of days for February. Have the user input information. Make sure the program can deal with any integer input. If a number entered does not correspond to a month of the year print \"Invalid Month.\"

Solution

#include<iostream.h>

#include<cono.h>

void main()

{

int i;

for(i=1;i<=100;i++)

{

if(i%2==0)

cout<<i<<endl;

}

}

A.for(i=1;i<=100;i=i+2)

{

if(i%2==0)

cout<<i<<endl;

}

B.

for(i=1;i<=50;i++)

{

if(i%2==0)

cout<<i<<endl;

}

C.

for(i=100;i>=0;i--)

{

if(i%2==0)

cout<<i<<endl;

}

d.

main()

{

int t ;

for ( ; ; ) {

scanf(\"%d\" , &t) ;

if ( t==10 ) break ;

}

E.

main()

{

int t ;

while ( ; ; ) {

scanf(\"%d\" , &t) ;

if ( t==10 ) break ;

}

F:

main()

{

int t ;

do {

scanf(\"%d\" , &t) ;

if ( t==10 ) break ;

}while(;;)

2.void main()

{

int due=0,rec=0;

cout<<\"enter the amount:\";

cin>>rec;

cout<<\"Enter the Due amount:\";

cin>>due;

cout<<\"Amout:<<\"$\"<<rec

}

3.


#include<stdio.h>
#include<conio.h>
void main()
{
int n;
clrscr();
printf(\"Month No:-> \");
scanf(\"%d\",&n);
switch(n)
{
   case 1:
   case 3:
   case 5:
   case 7:
   case 8:
   case 10:
   case 12:
   printf(\"Month have 31 days \ \");
   break;
   case 2:
   printf(\"2nd month is a february and have 28 days \ \");
   printf(\"in leap year The Feb Have 29 days\ \");
   break;
   case 4:
   case 6:
   case 9:
   case 11:
   printf(\"Month have 30 days \ \");
   break;
default:
   printf(\"invalid Month number\ Please try again ....\ \");
   break;
}
getch();
}

 Use loop structures below to print the even numbers 2 to 100. (2, 4, 6, 8, 10, etc) Each program will have the same output. Write a C++ programs that print the
 Use loop structures below to print the even numbers 2 to 100. (2, 4, 6, 8, 10, etc) Each program will have the same output. Write a C++ programs that print the
 Use loop structures below to print the even numbers 2 to 100. (2, 4, 6, 8, 10, etc) Each program will have the same output. Write a C++ programs that print the

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site