Subtraction of two numbers In c programming

0
Output

Explanation of the Subtraction Program

This C program takes two numbers from the user and performs subtraction. It subtracts the second number from the first number and stores the result in a variable named sum.

The program uses basic input functions to read numbers and simple arithmetic to calculate the result. It is a straightforward example for beginners learning how to work with variables and operators in C.

What the Program Does

  • Prompts the user to enter the first number (num1).
  • Prompts the user to enter the second number (num2).
  • Subtracts the second number from the first using sum = num1 - num2;.
  • Displays the final result on the screen.
  • Uses clrscr() to clear the screen (Turbo C function).
  • Uses getch() to pause the output window.

Example Input

Enter first number: 15
Enter second number: 7

Example Output

The result is: 8

Summary:
This program performs a simple subtraction of two user-entered numbers. It demonstrates the use of variables, arithmetic operations, scanf(), printf(), and Turbo C screen control functions.

Tags

Post a Comment

0Comments

Post a Comment (0)