The program is an illustration of loops.
Loops are used to perform repetitive and iterative operations.
The program in Python where comments are used to explain each line is as follows:
#This intializes the list
nums = [5,4,4,2,1]
#This gets the length of the list
size = len(nums)
#This iterates through the list
for i in range(size):
#The following if condition determines the repeating number
if nums[abs(nums[i])-1] > 0:
nums[abs(nums[i])-1] = -nums[abs(nums[i])-1]
else:
repeating = abs(nums[i])
#The following if condition determines the missing number
if nums[i]>0:
missing = i + 1
#This calculates and prints the sum of the missing and the repeating numbers
print(repeating+missing)
Read more about similar programs at:
brainly.com/question/13549861
Answer:
import java.util.Scanner;
class Main
{
public static void main(String[] args)
{
System.out.println(" Enter the the two numbers:");
Scanner input = new Scanner(System.in);
int a = input.nextInt();
int b = input.nextInt();
int c = sumsquareFunction(a, b);
System.out.println("Sum of Square of two numbers are:" + c);
}
public static int sumsquareFunction(int n1, int n2) {
int c= n1*n1 + n2*n2;
return c;
}
}
Explanation:
Please check the answer.
Answer:
Open a document: Ctrl + O.
Create a new document: Ctrl + N.
Save the current document: Ctrl + S.
Open the Save As window: F12.
Close the current document: Ctrl + W.
Split the window: Alt + Ctrl + S.
Copy: Ctrl+C
Paste: Ctrl+V
Cut the current selection: Ctrl + X
Copy the current selection: Ctrl + C
Paste the contents of the clipboard: Ctrl + V
Bold: Ctrl + B
Italics: Ctrl + I
Underline: Ctrl + U
Underline words only: Ctrl + Shift + W
Center: Ctrl + E
Make the font smaller: Ctrl + [
Make the font bigger: Ctrl + ]
Change text to uppercase: Ctrl + Shift + A
Change text to lowercase: Ctrl + Shift K
Insert a page break: Ctrl + Enter
Add a hyperlink: Ctrl + K
Explanation: