we can share the knowledge with our friends. So they can share with their friends. and so on...
Finally You can turn back ...how many of them stand behind you....
Monday, January 4, 2010
Program to display series and find sum of 1+3+5+……..+n.
#include
#include
void main()
{
int n,i,sum=0;
clrscr();
printf("Enter any no: ");
scanf("%d",&n);
for(i=1;i
{
printf("%d+",i);
sum=sum+i;
}
printf("%d",n);
printf("\nsum=%d",sum+n);
getch();
}
No comments:
Post a Comment