Answer:
import java.util.Scanner;
public class num2 {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int total = 0;
for(int i=0; i<5; i++){
System.out.println("Enter next Int: ");
total = total+in.nextInt();
}
System.out.println(total);
}
}
Explanation:
In the code above written in Java programming language, the for loop statement for(int i=0; i<5; i++) ensures that the loop goes from 0-4 a total of five times.
At each iteration it requests a user to enter an int. The number entered is stored in the variable total which is initially assigned 0.
When the loop finishes execution, total is printed out
<span>In describing an Initialization is when a value is assigned to a variable as part of the variable's definition or the assinged values to variables are defined whenever.
The best answer would be is that they present the keyword, when they tell the compiler.</span>
That’s not a question but good for her
Answer:
theSentence = input('Enter sentence: ')
theSentence = theSentence.split()
sentence_split_list =[]
for word in theSentence:
sentence_split_list.append(word[1:]+word[0]+'ay')
sentence_split_list = ' '.join(sentence_split_list)
print(sentence_split_list)
Explanation:
Using the input function in python Programming language, the user is prompted to enter a sentence. The sentence is splited and and a new list is created with this statements;
theSentence = theSentence.split()
sentence_split_list =[ ]
In this way every word in the sentence becomes an element in this list and individual operations can be carried out on them
Using the append method and list slicing in the for loop, every word in the sentence is converted to a PIG LATIN
The attached screenshot shows the code and output.
Answer:
The correct pseudocode to find the records of all citizens over the age of 50 is IF(age > 50).
OR EACH item IN citzlist
{
WHILE(not end of citzlist)
{
IF(age > 50)
{
DISPLAY(name)
}
}
}
If this is run, it will bring out all the names of the citizen who are over the age of 50 in the list.
Explanation: