Computer Science, asked by ajaz10, 1 year ago

how write a program to calculate the average of 3 numbers and print the result prompt the user to enter 3 values

Answers

Answered by softwarecrackerindia
1
24

#include<stdio.h>

 

void main()

{

  int i,n,Sum=0,numbers;

  float Average;

 

  printf("\nPlease Enter How many Number you want?\n");

  scanf("%d",&n);

 

  printf("\nPlease Enter the elements one by one\n");

  for(i=0;i<n;++i)

   {

     scanf("%d",&numbers);

     Sum = Sum +numbers;

   }

 

  Average = Sum/n;

 

  printf("\nSum of the %d Numbers = %d",n, Sum);

  printf("\nAverage of the %d Numbers = %.2f",n, Average);

 

  return 0;

}

Similar questions