Source code
#include <stdio.h>
#include <conio.h>
void main( )
{
int nm1;
float nm2,add,sub,mul,div;
printf("Enter two numbers: \n");
scanf("%d %f",&nm1,&nm2); /* Stores the two interger and floating point numbers entered by user in variable num1 and num2 respectively */
add = nm1+nm2; /* Performs addition and stores it */
sub = nm1-nm2; /* Performs substraction and stores it */
mul = nm1*nm2; /* Performs multiplication and stores it */
div = nm1/nm2; /* Performs division and stores it */
printf("addition is= %f\n",add);
printf("substraction is= %f\n",sub);
printf("multiplication is= %f\n",mul);
printf("division is= %f\n",div);
getch();
}
Output
Enter two numbers: 20 2.5
addition is= 22.50
substraction is= 17.50
multiplication is= 50.00
division is= 8.00
Download
#include <stdio.h>
#include <conio.h>
void main( )
{
int nm1;
float nm2,add,sub,mul,div;
printf("Enter two numbers: \n");
scanf("%d %f",&nm1,&nm2); /* Stores the two interger and floating point numbers entered by user in variable num1 and num2 respectively */
add = nm1+nm2; /* Performs addition and stores it */
sub = nm1-nm2; /* Performs substraction and stores it */
mul = nm1*nm2; /* Performs multiplication and stores it */
div = nm1/nm2; /* Performs division and stores it */
printf("addition is= %f\n",add);
printf("substraction is= %f\n",sub);
printf("multiplication is= %f\n",mul);
printf("division is= %f\n",div);
getch();
}
Output
Enter two numbers: 20 2.5
addition is= 22.50
substraction is= 17.50
multiplication is= 50.00
division is= 8.00
Download
No comments:
Post a Comment