Search⌘ K
AI Features

Challenge 1: Square Numbers and Return their Sum

Learn to implement a method in a C# class that takes three numbers, squares each, and returns their combined sum. This challenge reinforces your understanding of methods within classes and helps you practice algorithm design and implementation in C#.

Problem Statement

Implement a method SquaresSum(double num1, double num2, double num3), in a class SumOfSquares, which takes three numbers, squares them and returns their sum. This is just a refresher to test your knowledge of methods in C#.

Input

Three double numbers.

Output

The sum of the squares of the passed numbers

Sample Input

2, 3, 4

Sample Output

29

Coding Exercise

First, take a close look and design a step-by-step algorithm before jumping to the implementation. This problem is designed for your practice, so initially, try to solve it on your own. If you get stuck, you can always refer to the solution provided in the solution section.

Good Luck!

C#
class SumOfSquares {
// Method to square the sum of three numbers
public double SquaresSum(double num1, double num2, double num3) {
double sum = 0;
// Write your code here
return sum;
}
}

The solution will be explained in the next lesson.