Thursday, 13 October 2011

A program that will get the average of all intergers from 1 - 10 using do-while loop

#include<stdio.h>
#include<conio.h>

int main()
{

int x, sum;
float average;

{
     sum= 0;
     x= 1;
     do
     {
           x++;
          sum = sum + x;
        
          }while (x<=10);
          average = sum / 10.00;
          printf("The Computed average is %.2f\n",average);
          }
          getch();
          return 0;
          }

0 comments:

Post a Comment