Pages

Multiplication of two integer values entered by user

//Multiplication of two integer values entered by user.


#include<stdio.h>
#include<conio.h>

void main() {
  int num1,num2,multiplication;   //declare a integer varaiable
  clrscr();  //clear the screen
  printf("Enter the first number of an integer:");  //Show the message to user
  scanf("%d",&num1);  //Store the value entered by user in variable num1.
  printf("Enter the second number of an integer:");  //Show the message to user
  scanf("%d",&num2);   //Store the value entered by user in variable num2.
  multiplication=num1*num2;
  printf("multiplication:%d",multiplication);   //Multiplication of two numbers
  printf("\nAlso show multiplication of two integer numbers in other way:");
  printf("\n%d * %d = %d",num1,num2,multiplication);
  getch();  //Hold the screen for output
}

Output:

Enter the first number of an integer:20
Enter the second number of an integer:12
multiplication:240
Also show multiplication of two integer numbers in other way:
20 * 12 = 240

No comments:

Post a Comment