C Program to Div Two Numbers
In this program, user is asked to enter two integers. Then, the Div of those two integers is stored in a variable and displayed on the screen.
Program to Div Two Integers
#include <stdio.h> #include <conio.h> int main() { int firstNumber, secondNumber, divOfTwoNumbers; printf("Enter two integers: "); // Two integers entered by user is stored using scanf() function scanf("%d %d", &firstNumber, &secondNumber); // div of two numbers in stored in variable divOfTwoNumbers divOfTwoNumbers = firstNumber * secondNumber; // Displays div printf("%d / %d = %d", firstNumber, secondNumber, divOfTwoNumbers); getch(); } |
Output
Enter two integers: 1736
14
1736 / 14 = 124
In this program, user is asked to enter two integers. Two integers entered by the user is stored in variables firstNumber and secondNumber respectively. This is done using
scanf()
function.Then, variables firstNumber and secondNumber are subtracting using - operator and the result is stored in divOfTwoNumbers.
No comments: