ulvis.paste.net

Paste Search Dynamic
Recent pastes
values
  1. #include<stdio.h>
  2. int main()
  3. {
  4.   int n, values, count=0,Sum=0;
  5.   double Average;
  6.   printf("\nPlease Enter how many values you want to input?\n");
  7.   scanf("%d",&n);
  8.  printf("Number of the values = %d",n, count);
  9.   printf("\nPlease Enter the values one by one\n");
  10.   while(count<n)
  11.    {printf("Enter a positive Integer\n");
  12. scanf("%d", &values); if (values >= 0)
  13. { Sum = Sum + values; count = count + 1; }
  14. else { printf("Value must be positive\n"); }
  15.      scanf("%d",&values);
  16.      Sum = Sum +values;
  17.      count++;
  18.    }
  19.   Average = (double) Sum/n;
  20.   printf("\nSum of the %d Numbers = %d",n, Sum);
  21.   printf("\nAverage of the %d Numbers = %.2f",n, Average);
  22.   return 0;
  23. }
  24.  
Parsed in 0.005 seconds