C Program To Show Square Of Numbers And Find Their Sum

#include<stdio.h>
int main()
{
int i=1,n,sq,sum=0;
printf("Enter number:\n");
scanf("%d",&n);
printf("number\tsquare\n");
while(i<=n)
{
sq=i*i;
printf("%d\t%d\n",i,sq);
i++;
sum+=sq;
}
printf("sum is %d",sum);
return 0;
}

OUTPUT

C program to show square of numbers and find their sum

Share To:

Arogya Thapa Magar

Post A Comment:

0 comments so far,add yours