Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include<math.h>
- void main()
- {
- int i,n,sum=0,sq;
- printf("Input the number of terms : ");
- scanf("%d",&n);
- printf("\nThe square natural upto %d terms are :",n);
- for(i=1;i<=n;i++)
- {
- sq=pow(i,2);
- printf("%d ",sq);
- sum+=sq;
- }
- printf("\nThe Sum of Square Natural Number upto %d terms = %d \n",n,sum);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement