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
A web designer calls to report that the web server web-s1.cisco is not reachable through a web browser. The technician uses comm
Sergeeva-Olga [200]

Answer:

He can determine if the network is operational with a ping to the IP address.

If this fails, it means this is a DNS issue.

He can also determine if a router is down between the source and the server

Explanation:

A successful ping to IP address indicates that the network is working and the web server is online. Failure means that the host cannot resolve the associated domain name.

Try the web server at 192.168.0.10 is reachable from the source host. A router is down between the source host and the server web-s1.cisco.com. There is a problem with the web server software on web-s1.cisco.com

6 0
3 years ago
8. SQL, Oracle Report, and Visual Basic are all examples under the
Marat540 [252]
I am pretty sure the answer is the second gen
3 0
2 years ago
Assume that there is a class called BankAccountHolder that represents an individual member of a bank. There is also a BankAccoun
Elina [12.6K]

Answer:

Aggregation

Explanation:

In Java, Aggregation is a relationshipthat exists between two classes that is best described as a "has-a"

7 0
4 years ago
Read 2 more answers
A programming and software development professional would most likely help with
DiKsa [7]
A programming and software development professional would most likely help with
Testing a software program.
3 0
3 years ago
Consider the following class:
Pachacha [2.7K]

Answer:

c.return Integer.compare(value, otherTemp.value)

Explanation:

The compare() method as the name implies compares two integer values. If they are equal it returns 0, if the first number is smaller it returns -1, and if the first number is greater it returns 1.

It is an Integer class method that is why you need to type Integer.compare() to call the function.

For this example, the parameters that will be compared are <em>value</em>, and <em>otherTemp.value. </em>The type of compareTo method is an integer, we need to return the result.

3 0
3 years ago
Other questions:
  • Question 1:
    15·1 answer
  • Jimmy is running out of desk space. He keeps three computers on his desk. The three computers can’t be moved, and they need to b
    5·2 answers
  • _______________ is the term for the convergence of real-time and non-real-time communications services such as telephony, instan
    11·1 answer
  • If an administrator wanted to change the IP configuration settings on the first Ethernet interface to 10.1.1.1 and the netmask t
    12·1 answer
  • Bios types that can be updated without removing the bios chip from a motherboard
    9·1 answer
  • Write a program to assign distinct number between 1 and 200 into an int array of 100 elements in ascending order (you may reuse
    6·1 answer
  • Which sentence(s) below are true?a. IP stands for Internet Protocol.b. In most home networks IP addresses are assigned by the In
    6·1 answer
  • Which of these communication avenues is not regulated by the Federal Communications Commission (FCC)?
    12·1 answer
  • Create a list with 5 numbers and find the smallest and largest number in the list and also the sum and product of the numbers in
    9·1 answer
  • A computer lacks a division instruction and performs iteratively using the technique described on page 300. suppose we wish to e
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!