forgot to commit this
This commit is contained in:
14 files changed
+353
-20
No files matched your search
+28
-5
@@ -1,23 +1,46 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void) {
|
||||
/*
|
||||
* Course: COMP 2510
|
||||
* Assignment: Assignment 1
|
||||
* Name: Braeden Sowinski
|
||||
* Student ID: A01385066
|
||||
* Date: 2025-09-20
|
||||
* Description: Calculate sum of squares from X to Y
|
||||
*/
|
||||
|
||||
/**
|
||||
* main program entry
|
||||
*
|
||||
* takes in user input for an upper and lower
|
||||
* limit, then calculates the sum of squares
|
||||
* from the lower to the upper limit.
|
||||
*
|
||||
* continuously takes input until upper limit
|
||||
* is less than or equal to lower limit
|
||||
*/
|
||||
int main(void)
|
||||
{
|
||||
|
||||
int max;
|
||||
int min;
|
||||
int sumOfSquares;
|
||||
|
||||
do {
|
||||
do
|
||||
{
|
||||
|
||||
sumOfSquares = 0;
|
||||
|
||||
printf("Enter a lower and upper limit: ");
|
||||
scanf("%d %d", &min, &max);
|
||||
|
||||
if (max <= min) {
|
||||
if (max <= min)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
for (int i = min; i <= max; i++) {
|
||||
for (int i = min; i <= max; i++)
|
||||
{
|
||||
sumOfSquares += i * i;
|
||||
}
|
||||
|
||||
@@ -33,4 +56,4 @@ int main(void) {
|
||||
printf("Done\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user