#include <iostream>
using namespace std;
int main()
{
int num1, num2,r...
Computers and Technology, 13.02.2022 05:40 stephanierey075
#include <iostream>
using namespace std;
int main()
{
int num1, num2,r, i;
cout<<"Enter a start: ";
cin>>num1;
cout<<"Enter an end: ";
cin>>num2;
cout<<"\n\nODD NUMBERS\n";
for(i=num1; i<=num2; i++){
r=i%2;
if(r==1)
cout<<" "<<i;
}
cout<<"\nEVEN NUMBERS\n";
for(i=num1; i<=num2; i++){
r=i%2;
if(r==0)
cout<<" "<<i;
}
if(num1>num2){
cout<<"ERROR! Starting Number is GREATER THAN the Ending Number!!!";
return 0;
}
}
Using while loop, do while and for loop write a C++ program that lets you input a starting and ending integer (range) then display all the odd integers and the even integers within the range then compute the sum of each set of integers.:
If the starting number is greater than ending number, the program should display “ERROR! Starting Number is GREATER THAN the Ending Number!!!”.
Sample output:
Enter a start: 1
Enter an end: 10
ODD NUMBERS
1 3 5 7 9 Sum: 25
EVEN NUMBERS
2 4 6 8 10 Sum: 30
the attached pic has been my progress so far. please help me reach the expected output.
Answers: 1
Computers and Technology, 22.06.2019 23:50
List a few alternative options and input and output over the standerd keyboard and monitor. explain their functioning in details.
Answers: 2
Computers and Technology, 23.06.2019 00:30
Which of the following would you find on a network
Answers: 3
Computers and Technology, 23.06.2019 03:10
Acomputer has a two-level cache. suppose that 60% of the memory references hit on the first level cache, 35% hit on the second level, and 5% miss. the access times are 5 nsec, 15 nsec, and 60 nsec, respectively, where the times for the level 2 cache and memory start counting at the moment it is known that they are needed (e.g., a level 2 cache access does not even start until the level 1 cache miss occurs). what is the average access time?
Answers: 1
Computers and Technology, 23.06.2019 04:20
Which network media uses different regions of the electromagnetic spectrum to transmit signals through air? uses different regions of the electromagnetic spectrum to transmit signals through air.
Answers: 2
Chemistry, 25.02.2022 14:00
English, 25.02.2022 14:00
Business, 25.02.2022 14:00
Mathematics, 25.02.2022 14:00
Mathematics, 25.02.2022 14:00
Geography, 25.02.2022 14:00
Mathematics, 25.02.2022 14:00