Add_Sub

// Do addition & subtraction in line
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,c,s=0;
clrscr();
printf("\n");
for(a=1,b=2;a<=9;a+=2,b+=2)
{
c=a-b;
s=s+c;
}
printf("\n Sum is %d",s);
getch();
}

No comments:

Post a Comment