Tuesday, November 25, 2014

s=80+75+70+........

 

s=80+75+70+........

//s=80+75+70+........
 
#include<stdio.h>
main()
{
    int n,a=80,d=-5,sum=0,term;
 
    printf("ENTER N=");
    scanf("%d",&n);
 
    term=a+(n-1)*d;
 
    for(a=80;a>=term;a=a-5)
    {
        sum=sum+a;
    }
    printf("ANS=%d",sum);
}

No comments:

Post a Comment