Question

The program is made for deciding which of the two user defined numbers is greater. if...

The program is made for deciding which of the two user defined numbers is greater. if the
numbers entered by the user are same, then it should display a message accordingly. Develop
program using C language

Homework Answers

Answer #1

main.c

#include <stdio.h>

int main()
{
int n1, n2;
  
printf("Enter number 1: ");
scanf("%d", &n1);
printf("Enter number 2: ");
scanf("%d", &n2);
  
if(n1 > n2)
printf("%d is grater tham %d", n1, n2);
else if(n2 > n1)
printf("%d is grater tham %d", n2, n1);
else
printf("%d and %d are equal", n1, n2);

return 0;
}

Code Snippet (For Indentation):

Output:

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
Design a program that asks user to enter any three numbers. The program should display the...
Design a program that asks user to enter any three numbers. The program should display the three numbers in ascending order. using python code please
Create a Python program that: Allows the user to enter a phrase or sentence. The program...
Create a Python program that: Allows the user to enter a phrase or sentence. The program should then take the phrase or sentence entered Separate out the individual words entered Each individual word should then be added to a list After all of the words have been place in a list Sort the contents of the list Display the contents of the sorted list with each individual word displayed on a separate line Display a message to the user indicating...
Write a C++ program with a user-defined function myFactorial, that calculates the factorial of a number...
Write a C++ program with a user-defined function myFactorial, that calculates the factorial of a number entered by the user. Return the calculated factorial and print it in the main function.
Write a Python program which calculates the average of the numbers entered by the user through...
Write a Python program which calculates the average of the numbers entered by the user through the keyboard. Use an interactive loop and ask the user at each iteration if he/she wants to enter more numbers. At the end dispay the average on the screen. Using built-in library functions for finding average is not allowed. Sample output of the program: Enter a number > 23 More numbers (yes or no)? y Enter a number > 4 Do you have more...
C++ [Program-2] Write a program that accepts an indefinite set of numbers until the user enters...
C++ [Program-2] Write a program that accepts an indefinite set of numbers until the user enters “-1”. In other words, the program keeps accepting new values until the user provides a “-1” (your program accepts all values, and discards the “-1”). When done, the program prints back to the user: (i) the sum of all numbers entered (except -1), (ii) the minimum value seen across all numbers (except -1), and (iii) the maximum value across all numbers (except -1).
Write a C program to ask the user 3 number and display in the greater value...
Write a C program to ask the user 3 number and display in the greater value from it. Only use compound condition in if-Else statements.
Data Encryption (Strings and Bitwise Operators) Write a C program that uses bitwise operators (e.g. bitwise...
Data Encryption (Strings and Bitwise Operators) Write a C program that uses bitwise operators (e.g. bitwise XOR) to encrypt/decrypt a message. The program will prompt the user to select one of the following menu options: 1. Enter and encrypt a message 2. View encrypted message 3. Decrypt and view the message (NOTE: password protected) 4. Exit If the user selects option 1, he/she will be prompted to enter a message (a string up to 50 characters long). The program will...
11. First and Last Design a program that asks the user for a series of names...
11. First and Last Design a program that asks the user for a series of names (in no particular order). After the final person's name has been entered, the program should display the name that is first alphabetically and the name that is last alphabetically. For example, if the user enters the names Kristin, Joel, Adam, Beth, Zeb, and Chris, the program would display Adam and Zeb. I need help with creating a python code for this using a sentinel...
Use C++ Write a program that first reads in how many whole numbers the user wants...
Use C++ Write a program that first reads in how many whole numbers the user wants to sum, then reads in that many whole numbers, and finally outputs the sum of all the numbers greater than zero, the sum of all the numbers less than zero (which will be a negative number or zero), and the sum of all the numbers, whether positive, negative, or zero. The user enters the numbers just once each and the user can enter them...
User enters two numbers, N1, and N2. Write a program that determine if the numbers are...
User enters two numbers, N1, and N2. Write a program that determine if the numbers are twin primes. Definition: Twin primes are two prime numbers separated by 2. For example, 3 and 5 are both prime numbers and separated by 2. Another example is 17, 19.