Provide us with this "sum" function, and we can tell you. We aren't psychic.
21 years old. If you take 1944-1923 you get 21 because that would be ho wold they are
4. Only (ii)
<u>Explanation:</u>
The declaration of the array can be of two types:
1. int a[100];
2. int[] a = new int[100];
The general thing about an array is that whenever we want to undergo traversal in an array, we always have to start from the 0th position as the size of the array may be a whole number (let us say 10). So, to undergo traversal in an array, we start from 0 to n-1 (in this case 9) such that it covers the size of the array.
The size of an array can be finite or infinite. The general rule is it starts from 0 to n-1 where n is the size of the array. In the above example, the range of the index of the array will be 0 through 100 and not 1 through 100.
Answer:
public class num9 {
public static void main(String[] args) {
int sum =0;
int num =5;
for(num =5; num<=500; num+=5){
System.out.println(num);
sum +=num;
}
System.out.println(sum);
}
}
Explanation:
- Declare and initialize the variables sum and num
- Use a for loop with the condition for(num =5; num<=500; num+=5) Since the loop will increment by 5 and run from 5 to 500
- Within the loop, add num to sum at each iteration
- Print all elements on seperate lines
- Outside the loop, print the final value of sum
Create a for loop
Answer:
"The employee pay rate is normal" is the correct answer for the above question.
Explanation:
- The above question code is written in the c++ language, in which there is one variable of bool type whose value is true.
- And this variable is also tested in the if-condition which gives the true and the if-body will be executed.
- Then the internal if-condition will give the false result because the value of the empsalary is not less than 45000. It is because the above statement "empsalary=45000" will assign the value 45000 on the empsalary variable.
- Then the else block will be executed which prints "the employee pay rate is normal".