pastebin

Paste Search Dynamic
Recent pastes
Average
  1. #include <stdio.h>
  2. int main()
  3.  {
  4.   int marks[100], i, n, sum = 0;
  5.   double average;
  6.   printf("Enter number of elements: ");
  7.   scanf("%d", &n);
  8.   for(i=0; i < n; ++i) {
  9.     printf("Enter number%d: ",i+1);
  10.     scanf("%d", &marks[i]);
  11.     sum += marks[i];
  12.   }
  13.   average = (double) sum / n;
  14.   printf("Average = %.2lf", average);
  15.   return 0;
  16. }
Parsed in 0.006 seconds