1+2+4+7+11......up to numbers
//1+2+4+7+11......up to numbers#include<stdio.h>
main()
{ int i,sum=1,n,sum1=0; printf("enter number"); scanf("%d",&n); for(i=0;i<n;i++) {sum=sum+i;
sum1=sum1+sum;
}
printf("result=%d",sum1);}
This is my personal collection of daily lessons, professional insights, and programming experiences. It’s a space where I document what I learn, and you can explore and learn from my journey too.
No comments:
Post a Comment