0% found this document useful (0 votes)
3 views1 page

C Program to Compare Two Numbers

The document outlines a C programming assignment focused on inputting two numbers and determining which is greater using relational operators and if-else statements. It emphasizes learning user input with scanf(), decision-making logic, and displaying results with printf(). The assignment enhances understanding of conditional logic in C programming.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views1 page

C Program to Compare Two Numbers

The document outlines a C programming assignment focused on inputting two numbers and determining which is greater using relational operators and if-else statements. It emphasizes learning user input with scanf(), decision-making logic, and displaying results with printf(). The assignment enhances understanding of conditional logic in C programming.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Problem No: 06

Problem Name: Write a C program to input two numbers and determine which number is greater.
Objectives
• To learn how to receive input from the user using the scanf() function
• To understand the use of relational operators such as >, <.
• To apply decision-making using if–else statements
• To display results properly using the printf() function
Program (C Language):

Input and Output:


Input:
Enter first number: 5
Enter second number: 15
Output:

Discussion :From this assignment, I learned how to take user input using the scanf() function and
compare two integer values using conditional logic. The program evaluates whether the first number is
larger, the second number is larger, or if both numbers are the same. This task improves understanding of
decision-making concepts and the practical use of if–else statements in C programming.

You might also like