Sum of square program, Algorithm and Flowchart
Q. Write a C program to accept a number from user and print the sum of square. Also write down the algorithm and draw flowchart.
Ans.
/*c program for accept number and calculate sum of square*/
#include<stdio.h>
int main()
{
int num,sum=0,i;
printf("Enter any number : ");
scanf("%d", &num);
for(i=1; i<=num; i++)
sum = sum + (i*i);
printf("Sum of square of %d = %d",num,sum);
return 0;
}
The output of above program would be:
Algorithm for accept a number from user and calculate sum of square:
[Sum of square procedure:accept number num from user, and set sum=0 and calculate sum of square.]
Step 1. Start
Step 2. Read number num
Step 3. [Initialize]
sum=0, i=1
Step 4. Repeat step 4 through 6 until i<=num
Step 5. sum=sum+(i*i)
Step 6. i=i+1
Step 7. print the sum of square
Step 8. stop
[end of loop step 4]
[end of sum of square procedure]
Flowchart for sum of square C program as following:
Ans.
/*c program for accept number and calculate sum of square*/
#include<stdio.h>
int main()
{
int num,sum=0,i;
printf("Enter any number : ");
scanf("%d", &num);
for(i=1; i<=num; i++)
sum = sum + (i*i);
printf("Sum of square of %d = %d",num,sum);
return 0;
}
The output of above program would be:
![]() |
| Figure: Screen shot for calculate sum of square of number C program |
Algorithm for accept a number from user and calculate sum of square:
[Sum of square procedure:accept number num from user, and set sum=0 and calculate sum of square.]
Step 1. Start
Step 2. Read number num
Step 3. [Initialize]
sum=0, i=1
Step 4. Repeat step 4 through 6 until i<=num
Step 5. sum=sum+(i*i)
Step 6. i=i+1
Step 7. print the sum of square
Step 8. stop
[end of loop step 4]
[end of sum of square procedure]
Flowchart for sum of square C program as following:
![]() |
| Figure: Flowchart for calculate sum of square C progra |


Casinovnj - Slots & casino: bonus codes, bonuses, list of casinos
ReplyDeleteThe 대구광역 출장안마 best Casino sites are now available on both Betika and Betika, and the 김천 출장샵 casino sites you 경상북도 출장안마 choose on 당진 출장안마 the site offers generous 수원 출장안마
The keyword Cricbet99 live casino relates to live casino gaming information and may interest readers researching available gaming categories. Content about this subject should explain the general nature of live casino games while avoiding claims that particular outcomes can be predicted. Readers should understand that casino results involve chance and that losses are possible. Reviewing applicable rules, age requirements, account conditions, and responsible-gaming guidance can help users make informed decisions when considering any online gaming activity.
ReplyDeleteThe information regarding thereddybookclub.com Reddybook app provides a useful introduction for readers interested in mobile access and platform features. App-related information can be particularly helpful because users often want to understand available functionality before using a service on their device. I liked the straightforward presentation of the topic and the focus on practical details. Readers can use this information to become familiar with the general app experience, available options, and considerations that may be relevant when accessing a platform.
ReplyDeleteReaders using the phrase 99exch id 99exchcom.com may be looking for general information about account identification and access procedures. A useful discussion can highlight the importance of reviewing registration instructions and protecting personal login information. Users should also understand applicable platform rules, transaction conditions, privacy practices, and responsible-use requirements before proceeding. Good account security begins with strong, private credentials and careful attention to official instructions rather than relying on unverified information from unknown sources.
ReplyDelete