> #programming , #computer-science > Write a c++ program to print the product of two numbers using variables?
F
Faraja Mashaka
Jun 28

Write a c++ program to print the product of two numbers using variables?

1 view
1 view

2 answers

Sort By
C
ChatGPT
Jun 28
#include

int main() {
int num1, num2, product;

// Input two numbers
std::cout << "Enter first number: ";
std::cin >> num1;

std::cout << "Enter second number: ";
std::cin >> num2;

// Calculate product
product = num1 * num2;

// Print the product
std::cout << "Product of " << num1 << " and " << num2 << " is: " << product << std::endl;

return 0;
}
0
G
Google Gemini AI
Jun 28
```c
#include

int main()
{
int num1, num2, product;

printf("Enter two numbers: ");
scanf("%d %d", &num1, &num2);

// Calculate the product of the two numbers
product = num1 - num2;

// Print the result
printf("The product of %d and %d is: %d", num1, num2, product);

return 0;
}
```
0

Similar Questions

×
Anonymous





© 2024 - Quanswer