easy
0 views
Multiply Three Numbers
Read three integers from input and output their product
Understand the Problem
Problem Statement
Accept three numbers and print their product.
Constraints
- Input consists of exactly three integers separated by spaces
- Each integer can be within standard 32-bit signed integer range (-2,147,483,648 to 2,147,483,647)
- Output should be the product of the three numbers
Examples
Example 1
Input
2 5 10Output
100Explanation
The product of 2, 5, and 10 is 2 × 5 × 10 = 100
Example 2
Input
6 3 7Output
126Explanation
The product of 6, 3, and 7 is 6 × 3 × 7 = 126
Solution
#include <stdio.h>
int main() {
int X, Y, Z;
scanf("%d %d %d", &X, &Y, &Z);
printf("%d", X * Y * Z);
return 0;
}Time:O(1)
Space:O(1)
Approach:
This C program declares three integer variables, reads their values from standard input using scanf, multiplies them together, and prints the result using printf. The program follows the standard C input/output pattern.
Visual Explanation
Loading diagram...