C program to find sum and average of three numbers.

1. Program Outline

In this C tutorial we will learn how we can find Sum and average of three numbers. I’ll help you to understand the concept behind it and then we’ll move forward to write C program to find sum and average of three numbers. I’ll explain the Algorithm, Concepts and then we’ll move forward to write it’s Code.

It is one of the basic program in C and generally for the beginners to understand the basic structure of C. In this program we’ll take three numbers as a input from the user and then calculate it’s sum and average and display it in the end.

2. Concepts

The main Concept behind writing this C Program is to Take three numbers from the user then store it in the variable then do calculations and print the required Output .For doing this much of stuff you have to be familiar with certain Basic Concept of C :-

  1. Input/Output
  2. Scanf( )
  3. Operators

3. Algorithm

Here’s the detailed algorithm of our C Program to find sum and average of three numbers.

Step 1: Start

Step 2  :Read the three number let "a","b","c" form the user.

Step 3: Declared a variable "sum"  and "Avg".

Step 4 : sum=a+b+c;

Step 5:  Avg=sum/3;

Step 6: Display "sum " and "Avg".

Step 7 :End .

4. Program

Here’s the C program.

#include <stdio.h>
int main()
      int a,b,c;
      float sum;
      float avg;
      printf("\nEnter First Number  : ");
      scanf("%d", &a);
      printf("\nEnter Second Number : ");
      printf("\nEnter Third Number : ");
      // For Sum 
      printf("\nsum: %.2f",sum);
      // For Average
      printf("\nAverage of Three Numbers : %.2f",avg);
      return 0;

5. Output

Here’s our required output of the above C program :-

If you find something incorrect or have any questions or feedback please comment down below Thank you.

Similar Posts

Leave a Reply

Your email address will not be published.