Write a program that inputs three numbers and calculate the sum of all three numbers.
Answers
Answered by
0
Answer:
I Hope you find your answer After my reply.
Explanation:
#include <stdio.h>
int num1,num2,num3;
int sum;
char line_text[50];
int main()
{
printf("Input three numbers separated by comma : ");
fgets(line_text, sizeof(line_text), stdin);
sscanf(line_text, "%d, %d, %d", &num1, &num2, &num3);
sum = num1+num2+num3;
printf("The sum of three numbers : %d\n", sum);
return(0);
}
Sample Output:
Input three numbers seperated by comma : 5,10,15
The sum of three numbers : 30
Similar questions
Science,
2 months ago
Math,
2 months ago
Physics,
2 months ago
Social Sciences,
4 months ago
Math,
10 months ago
Computer Science,
10 months ago
English,
10 months ago