Sum and Average Of 3 Numbers : C Program to find the sum and average of given three numbers:- Here in this blog post, let us discuss how to write a basic C program to find the sum and average of 3 numbers. This post includes the two different programs to find the sum and average for integer values and for the float values. Program to find the Sum and average of 3 given integer values:- The below is a Data input and output program which takes the given input from the console and performs the operation and then prints the output to the console. Program: - #include <stdio.h> void main() { int num1, num2, num3; int sum, avg; printf("Enter three integer values : "); scanf("%d %d %d", &num1, &num2, &num3); sum = num1 + nnum2 + num3; printf("sum of %d, %d and %d : %d\n", num1, num2, num3, sum); avg = sum / 3; printf("Average of %d, %d and %d : %d\n", num1, num2, num3, avg); } Output: - Enter three integer values : 40 20 30 sum of 40...
Comments
Post a Comment
Leave your Quires here!