Advertisement
SOIKAT

Untitled

Oct 7th, 2019
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.37 KB | None | 0 0
  1. #include <stdio.h>
  2. #include<math.h>
  3.  
  4. void main()
  5. {
  6.    int i,n,sum=0,sq;
  7.    printf("Input the number of terms : ");
  8.    scanf("%d",&n);
  9.    printf("\nThe square natural upto %d terms are :",n);
  10.    for(i=1;i<=n;i++)
  11.    {
  12.        sq=pow(i,2);
  13.      printf("%d ",sq);
  14.      sum+=sq;
  15.    }
  16.    printf("\nThe Sum of Square Natural Number upto %d terms = %d \n",n,sum);
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement