Addition of two numbers In c programming

0
Output

Explanation of the Addition Program

This C program takes two numbers from the user and performs addition. It adds the first and second number and stores the total in a variable named sum.

The program uses simple input and output functions along with the + operator to calculate the final result. It is a perfect example for beginners learning arithmetic operations in C.

What the Program Does

  • Asks the user to enter the first number (num1).
  • Asks the user to enter the second number (num2).
  • Adds both numbers using sum = num1 + num2;.
  • Displays the total result on the screen.
  • Uses clrscr() to clear the screen (Turbo C specific function).
  • Uses getch() to pause the output window.

Example Input

Enter first number: 12
Enter second number: 8

Example Output

The result is: 20

Summary:
This program performs simple addition of two numbers entered by the user. It demonstrates how to use variables, scanf(), printf(), arithmetic operators, clrscr(), and getch() in C.

Tags

Post a Comment

0Comments

Post a Comment (0)