C++ Code: -input any number between (0-100) • if the number is odd, the program
ID: 3716577 • Letter: C
Question
C++ Code: -input any number between (0-100) • if the number is odd, the program ends (do nothing) • if the number is even, output all the even numbers to 100 above the inputRequirements: use if statements (minimum 1), and minimum 1 loop C++ Code: -input any number between (0-100) • if the number is odd, the program ends (do nothing) • if the number is even, output all the even numbers to 100 above the input
Requirements: use if statements (minimum 1), and minimum 1 loop C++ Code: • if the number is odd, the program ends (do nothing) • if the number is even, output all the even numbers to 100 above the input
Requirements: use if statements (minimum 1), and minimum 1 loop
Explanation / Answer
#include<iostream.h>
#include<conio.h>
void main()
{
int number,i;
clrscr();
cout<<"enter a number between 0 to 100 ";
cin>>number;
if(number%2==0)
{
for(i=number+2;i<=100;i=i+2)
{
cout<<i<<" ";
}
}
getch();
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.