netoops blog

Sunday, 25 August 2013

Sum_Avg_First_20_Natural_No

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

void main()
{
    int i;
    float avg, s = 0.0;
    clrscr();
    for (i=1;i<=20;i++)
    s = s + i;
    avg = s / 20;
    printf("The sum is %d\n", s);
    printf("The average is %f\n", avg);
    getch();
}

Tech Knowledege
SOCIALIZE IT →
FOLLOW US →
SHARE IT →

0 comments :

Post a Comment

 
Subscribe For Free Updates!

We'll not spam mate! We promise.

Become Our Fan on Social Sites!