Write a C++ Program to Multiply two Numbers



Write a C++ Program to Multiply two Numbers..

Answer / hr

Solution:
/* C++ Program to Calculate Multiplication of two Numbers */
#include <iostream>
using namespace std;
int main()
{
double first, second, product;
cout << "Enter 1st number :: ";
cin >> first;
cout << "
Enter 2nd number :: ";
cin >> second;
product = first * second;
cout << "
Product of Two Numbers [ "<<first<<" * "<<second<<" ] = " << product<<"
";
return 0;
}
Output:
/* C++ Program to Calculate Multiplication of two Numbers */
Enter 1st number :: 5
Enter 2nd number :: 8
Product of Two Numbers [ 5 * 8 ] = 40
Process returned 0

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C++ General Interview Questions

What are the advantages of pointers?

0 Answers  


Given an array of size N in which every number is between 1 and N, determine if there are any duplicates in it. You are allowed to destroy the array if you like. [ I ended up giving about 4 or 5 different solutions for this, each supposedly better than the others ].

1 Answers  


What is a node class in c++?

0 Answers  


How did c++ get its name?

0 Answers  


Consider a c++ template funtion template<class T> T& Add(T a, T b){return a+b ;} if this function is called as T c = Add("SAM", "SUNG"); what will happen? What is the problem in the template declaration/ How to solve the problem.

7 Answers   LG, Samsung,






Write a program to calculate the BMI of a person using the formula BMI = weight/height2.

2 Answers  


What is the precedence when there is a global variable and a local variable in the program with the same name?

0 Answers  


What is pointer to member?

0 Answers  


What is Pure Virtual Function? Why and when it is used ?

10 Answers   Lucent, Sona,


Explain what happens when a pointer is deleted twice?

0 Answers  


Can static member variables be private?

0 Answers  


Define basic type of variable used for a different condition in C++?

0 Answers  


Categories