C Program To Multiply Two Numbers
♣ Try it Out ::
#include<stdio.h>
#include<conio.h>
int main()
{
// code for multiplying integers
int a, b, mul1;
printf("\nEnter two Integers: ");
scanf("%d %d", &a, &b);
mul1 = a * b;
printf("Result1: %d * %d = %d\n", a, b, mul1);
// code for multiplying floating numbers
float c, d, mul2;
printf("\nEnter two Floating numbers: ");
scanf("%f %f", &c, &d);
mul2 = c * d;
printf("Result2: %.2f * %.2f = %.2f\n", c, d, mul2);
getch();
return(0);
}
♣ Output ::
Enter two Integers: 8 6 Result1: 8 * 6 = 48 Enter two Floating numbers: 5 5.5 Result2: 5.00 * 5.50 = 27.50
♣ Downloads ::
Comments
Post a Comment