Question

Write a program that asks the user for an even integer, and asks again as long...

Write a program that asks the user for an even integer, and asks again as long as the given integer is not even (then it just thanks the user)

Homework Answers

Answer #1

SOURCE CODE IN C PROGRAMMING

#include <stdio.h>
void main()
{
int n;
printf("enter the even integer\t");
scanf("%d",&n);//read the number by the user
do
{
if(n%2==0)//check the number is even or not even
printf("even number\n");
else
break; //If the number not even then break and continue with the next statement after the loop
printf("enter even integer again\t");
scanf("%d",&n);//read the number again from the user
}
while(n%2==0);//loop run until the number is even
printf("\n not an even number \n thank you ");//Execute after the break statement if the number not even
}

SAMPLE OUTPUT

enter the even integer 8

even number

enter even integer again 10

even number

enter even integer again 12

even number

enter even integer again 17

not an even number

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Write a program that asks the user of a positive integer value. The program should use...
Write a program that asks the user of a positive integer value. The program should use a loop to get the sum of all the integers from 1 up to the number entered. For example, if the user enters 50, the loop will find the sum of 1,2,3,4,…,50. using namespace std;
in c++ Write a C++ program that asks the user to enter an integer number and...
in c++ Write a C++ program that asks the user to enter an integer number and prints it back "vertically" to the screen. Use recursion in your solution. As an example of how the program will work: Please enter an integer: 12345 The integer you entered will print vertically as: 1 2 3 4 5
Write a program in C++ coding that asks the user to input an integer between 25...
Write a program in C++ coding that asks the user to input an integer between 25 and 50, inclusive. Utilize a WHILE loop to test for INVALID input. If the input is INVALID, the loop will repeat, and ask the user to try again. The pseudocode looks like this: Prompt user to input an integer between 25 and 50 Accept the input from the user Test for invalid input (HINT: use a while loop and the OR operator with 2...
Write a program that asks the user to input an integer between 25 and 50, inclusive....
Write a program that asks the user to input an integer between 25 and 50, inclusive. Utilize a WHILE loop to test for INVALID input. If the input is INVALID, the loop will repeat, and ask the user to try again. The pseudocode looks like this: Prompt user to input an integer between 25 and 50 Accept the input from the user Test for invalid input (HINT: use a while loop and the OR operator with 2 relational expressions. You...
write a C++ program that asks the user to enter 4 integer numbers then use if...
write a C++ program that asks the user to enter 4 integer numbers then use if ….. elseif ….. elseif ….. else to find the smallest number then display it.
problem 1 Write a program that asks the user for an integer and then prints out...
problem 1 Write a program that asks the user for an integer and then prints out all its factors. For example, when the user enters 84, the program should print 2 2 3 7 Validate the input to make sure that it is not a character or a string using do loop. in c plus plus
Write a mips assembly language program that asks the user to enter and integer number and...
Write a mips assembly language program that asks the user to enter and integer number and read it. Then ask him to enter a bit position (between 0 and 31) and display the value of that bit.
Write a program that asks the user to enter two integer numbers. the main function then...
Write a program that asks the user to enter two integer numbers. the main function then passes these numbers to a function named exp that calculates the multiplication of these numbers and print the exponential value of the result of multiplication
write a program that asks the User to enter a letter, then asks the user to...
write a program that asks the User to enter a letter, then asks the user to enter a sentence. the program will then print out how many time that letter occurred in the sentence. in C Language
Write an assembly program which asks user to enter a character from ‘A’ to ‘Z’. If...
Write an assembly program which asks user to enter a character from ‘A’ to ‘Z’. If the user enters any other character, the program asks user to enter the character again. In this way the program inputs 300 characters and stores it in memory location from address $1000 to $112B. Hint: Use CPU register Y as counter
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT
Active Questions
  • 4. Prove explicitly that congruence modulo 4 is an equivalence relation. Then list the equivalence classes....
    asked 2 minutes ago
  • a.) The photoelectric effect is the basis of the spectroscopic technique known as photoelectron spectroscopy. An...
    asked 3 minutes ago
  • [The following information applies to the questions displayed below.] Washington Warehouse is a small retail business...
    asked 10 minutes ago
  • Given the following two sets of quotations by two currency dealers: Dealer A                               &n
    asked 12 minutes ago
  • The programming language for this exercise must be on C++. The exercise is the following: Design...
    asked 12 minutes ago
  • Continuity, differentiability questions: • Give an example of a function f: R → R that is...
    asked 12 minutes ago
  • What are some non-verbal differences in cultures, different countries, etc that can be mis-interpreted in a...
    asked 22 minutes ago
  • The probability that a person has a certain disease is 0.05 Medical diagnostic tests are available...
    asked 33 minutes ago
  • In operating system: What process resources are associated with each thread that it does not share...
    asked 34 minutes ago
  • Suppose that in a senior college class of 500 ​students, it is found that 212 smoke,...
    asked 40 minutes ago
  • A scuba diver has his lungs filled to half capacity (3 liters) when 10 m below...
    asked 51 minutes ago
  • A 36 kg child sits in the bed of a 3300 kg pickup truck over the...
    asked 58 minutes ago