1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
-BARSIC- [3]
3 years ago
9

Using for loop . Input an integer and identify whether it's EVEN OR ODD ( without using modulo operator )

Computers and Technology
1 answer:
vladimir2022 [97]3 years ago
6 0

Answer:

Following are the program in c++ language

#include<iostream> // header file

using namespace std; // namespace

int main()  

{

int n1,i; // variable declaration

cout<<"Enter Number: ";

cin>>n1; // input number

for(i=n1;i>1;i=i-2) // check the condition  

{

n1 = n1-2; // decrement the value of number by -2  

}

if(n1==0) // check if it is 0

cout<<"number is EVEN"<<"\n"; // print even

else

cout<<"number is ODD"<<"\n"; // print odd

return 0;

}

Output:

Enter Number: 45

number is ODD

Again run the program

Enter Number:10

number is EVEN

Explanation:

In this program, we input the number by a user in variable n1. After that, we iterate the for loop and initialize the value of a variable" i" in for loop and check the condition.

In each iteration, the variable n1 is decrement by 2 and store it n1.

Finally, check if n1==0 then it print number is EVEN  otherwise it print number is ODD.

You might be interested in
Hellpppppppppppppppp
jonny [76]

Answer:

i can't see your problem

6 0
2 years ago
Read 2 more answers
Drag each tile to the correct box.
Likurg_2 [28]
Learning
planning
designing
developing
testing delivering
4 0
3 years ago
Please answer this question correctly​
jeka94

Im only in 4th sorry i dont think i can help

5 0
3 years ago
What is MS-Word? Write some versions of MS-Word.
shtirl [24]
Ms- word it is , hope it was helpful
8 0
3 years ago
Read 2 more answers
8.7 Code Practice Question 3
lorasvet [3.4K]

I included my code in the picture below.

8 0
3 years ago
Read 2 more answers
Other questions:
  • Who were called “freedmen” during the reconstruction period?
    15·2 answers
  • what key aspects did you learn regarding the creation, analysis, and management of information systems? How will this impact you
    5·1 answer
  • Write a program that receives an character and displays its Unicode. Here is a sample run: Enter an character: E The Unicode for
    8·1 answer
  • All computers perform disk optimization utilizing the same software.<br><br> true <br> false
    11·1 answer
  • An interface does not have ____.
    13·1 answer
  • A distortion of information about the demand for a product as it passes from one entity to the next across the supply chain is c
    10·1 answer
  • To check if your operating system is up to date, click Start then click Control Panel and choose _______________. Select one: a.
    11·1 answer
  • HELP MY TABLET KEEPS ON REBOOTING I TRIED TO FACTORY RESET BUT IT KEEPS ON REBOOTING
    12·2 answers
  • Direction: Read each item carefully and choose the letter of the correct answer. Write your answers on a separate sheet of paper
    12·1 answer
  • Type the correct answer in the box. Use numerals instead of words. If necessary, use / for the fraction bar.
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!