Q. – Write a C program to find the Product of given two numbers.
Ans:- Two numbers, says a and b, are given (input) and the result product = a*b of two numbers are to be calculated.
/* Arithmetic Operators Product or Multiplication */
#include <stdio.h>
main()
{
int a, b, product;
scanf("%d %d", &a, &b);
product = a*b;
printf("%d", product);
return 0;
}
User Friendly Program
/* Arithmetic Operators Product or Multiplication – User friendly program */
#include<stdio.h>
main()
{
int a, b, product;
printf("\n Enter Value to A: ");
scanf("%d", &a);
printf("\n Enter Value to B: ");
scanf("%d", &b);
product = a*b;
printf("\n Product = %d", product);
return 0;
}
No comments