Discussion Forums

New User? Please read instructions!

C program to find sum and average of given 3 numbers  

  RSS

thiyagarajan
Eminent Member
Joined:10 months  ago
Posts: 26
27/01/2017 9:33 am  

Need C program to find sum and average of given 3 numbers


ReplyQuote
admin
Eminent Member Admin
Joined:5 years  ago
Posts: 26
31/01/2017 10:51 am  

Hi Thiyagarajan, please use below C program to find sum and average of given 3 numbers.

 

#include<stdio.h>

int main()

{

  int a,b,c, sum;

  float d;

  printf("Please enter 3 numbers");

  scanf("%d%d%d",&a,&b,&c);

  sum=a+b+c;

  d=(a+b+c)/3;

  printf("\nSum is %d", sum);

  printf("\nAverage is  %f",d);

  return 0;

}

Edited: 10 months  ago

ReplyQuote
myagaraa
New Member
Joined:2 months  ago
Posts: 1
03/10/2017 11:11 pm  

i need help for 

int main(void) {
 
  double a, b, c, sum = 0;
 
  printf("Input 3 numbers: ");
  scanf("%lf%f%lf", &a, &b, &c);
  sum = a + b + c;
  printf("The sum is %lf.\n", sum);
this 3 given number sum and average 
Input 3 numbers: 80.0 76.0 84.0
 The sum is 240.0.
 The average is 80.0.
 The result of sorting is 84.0 80.0 76.0.   
Edited: 2 months  ago

ReplyQuote
  
Working

Please Login or Register






Share this website !!!
Facebook Twitter Linkedin