c++ program on this question
Attachments:
Answers
Answered by
0
I hope you help !!!!
________________________________✓
=>-1down votefavorite
Use while loop to print series of even and odd numbers
c++
I know I'm missing something real simple but I can't seem to get the numbers to print out in rows of just odd or just even numbers using a while loop or loops. Also It keeps printing out "the even numbers are:"/ "the odd numbers are:" for every number.
#include<stdio.h> #include <iostream> using namespace std; int main() { //declare variables int number; int n; cout << "Enter value less than 100: "; cin >> n; //take user input while (n <= 100) //loop only if n equals 100 or less { for(number = n; number <= n; number++) //for loop to increment int value { if(number % 2 !=0) //determines if odd { cout << "The odd numbers are:" <<number << endl; //prints odd values } } for(number = n;number <= n; number++) // for loop to increment int value { if(number % 2 ==0) //determines if even { cout <<"The even numbers are:" <<number <<endl; //prints even values } } n++; } return 0; //end of program }
________________________________✓
=>-1down votefavorite
Use while loop to print series of even and odd numbers
c++
I know I'm missing something real simple but I can't seem to get the numbers to print out in rows of just odd or just even numbers using a while loop or loops. Also It keeps printing out "the even numbers are:"/ "the odd numbers are:" for every number.
#include<stdio.h> #include <iostream> using namespace std; int main() { //declare variables int number; int n; cout << "Enter value less than 100: "; cin >> n; //take user input while (n <= 100) //loop only if n equals 100 or less { for(number = n; number <= n; number++) //for loop to increment int value { if(number % 2 !=0) //determines if odd { cout << "The odd numbers are:" <<number << endl; //prints odd values } } for(number = n;number <= n; number++) // for loop to increment int value { if(number % 2 ==0) //determines if even { cout <<"The even numbers are:" <<number <<endl; //prints even values } } n++; } return 0; //end of program }
kartik3190:
???????
Answered by
0
Answer:yo to ave tha
Explanation:na bera
Similar questions