QUESTION 1 1. How will the loop below display: int count = 1; while (count < 10)
ID: 3736290 • Letter: Q
Question
QUESTION 1
1. How will the loop below display:
int count = 1;
while (count < 10){
printf(" %i", count);
count = count + 1;
}
numbers from 1 to 10
numbers from 1 to 9
numbers from 0 to 9
numbers from 0 to 10
QUESTION 2
1. How many times the loop below will run:
int count = 1;
while (count <= 10){
printf(" %i", count);
count = count + 1;
}
9
11
10
none of the above
QUESTION 3
1. How many times the loop below will run:
int count = 0;
while (count < 11 ){
printf(" %i", count);
count = count + 1;
}
9
10
11
none of the above
]QUESTION 4
1. How many times the loop below will run:
int count = 0;
while (count < 10){
printf(" %i", count);
count = count + 1;
}
9
10
11
none of the above
QUESTION 5
1. The loop below is a pre-test loop
int count = 1;
do{
printf("%i ", count);
count++;
}while (count <= 3);
True
False
QUESTION 6
1. How will the loop below display:
int count = 0;
while (count < 10){
printf(" %i", count);
count = count + 1;
}
numbers from 1 to 10
numbers from 1 to 9
numbers from 0 to 9
numbers from 0 to 10
QUESTION 7
1. How will the loop below display:
int count = 9;
while (count > =0){
printf(" %i", count);
count -= 1;
}
numbers from 10 to 1
numbers from 9 to 1
numbers from 9 to 0
numbers from 10 to 0
QUESTION 8
1. How many times the loop below will run:
int count = 1;
while (count < 10){
printf(" %i", count);
count = count + 1;
}
9
11
10
none of the above
QUESTION 9
1. How will the loop below display:
int count = 9;
while (count > 0){
printf(" %i", count);
count -= 1;
}
numbers from 10 to 1
numbers from 9 to 1
numbers from 9 to 0
numbers from 10 to 0
QUESTION 12
1. Write a for loop that runs 5 times and accepts the input of an integer number every time. Those numbers will be accumulated by a variable called total.
Explanation / Answer
QUESTION 1
Ans)numbers from 1 to 9
____________
QUESTION 2
Ans)10
____________
QUESTION 3
Ans)11
____________
QUESTION 4
Ans)10
____________
QUESTION 5
Ans)False
____________
QUESTION 6
Ans)numbers from 0 to 9
___________
QUESTION 7
Ans)numbers from 9 to 0
___________
QUESTION 8
Ans)9
___________
QUESTION 9
Ans)numbers from 9 to 1
__________
QUESTION 12
Ans)
SumOfNos.java
import java.util.Scanner;
public class SumOfNos {
public static void main(String[] args) {
//Declaring variables
int tot=0,num;
/*
* Creating an Scanner class object which is used to get the inputs
* entered by the user
*/
Scanner sc = new Scanner(System.in);
for(int i=1;i<=5;i++)
{
//Getting the input entered by the user
System.out.print("Enter Number#"+(i)+":");
num=sc.nextInt();
tot+=num;
}
System.out.println("Sum :"+tot);
}
}
______________
Output:
Enter Number#1:45
Enter Number#2:43
Enter Number#3:32
Enter Number#4:67
Enter Number#5:77
Sum :264
______________Thank You
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.