Skip to content

Instantly share code, notes, and snippets.

@jeremiahseun
Created February 25, 2022 21:22
Show Gist options
  • Select an option

  • Save jeremiahseun/f84a626b49d6fa6dc4bfbdd37bffc43e to your computer and use it in GitHub Desktop.

Select an option

Save jeremiahseun/f84a626b49d6fa6dc4bfbdd37bffc43e to your computer and use it in GitHub Desktop.
Function to find Sum of Squares of any Two Number
import 'dart:io'
void main() {
// THE VALUE TO BE USED
late int firstNumber;
late int secondNumber;
late int squareFirst;
late int squareSecond;
late int total;
print("Finding the sum of squares of two numbers");
// GETTING THE FIRST NUMBER
print("Enter the first number: ");
firstNumber = int.parse(stdin.readLineSync()!);
// GETTING THE SECOND NUMBER
print("Enter the second number: ");
secondNumber = int.parse(stdin.readLineSync()!);
print("Processing...");
// PEFORMING THE SQAURES OF BOTH NUMBERS
squareFirst = firstNumber*firstNumber;
squareSecond = secondNumber*secondNumber;
// ADDING THE SQUARES AND RETURNING IT TO THE USER
total = squareFirst + squareSecond;
print("The total is $total");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment