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
The answer for Apex College and Career Prep 2 would be Probable College.
int sum = 0, n;
do {cin>>n; sum+=n;}while (n!=0);
cout<<sum;
Answer:
Following are the code in the C Programming Language.
//set integer datatype variable
int score;
//check condition is the score is in the range of 0 to 100
if(score > 0 && score < 100){
//print if condition is true
printf("Valid test scores");
}else{
//otherwise print the following string.
printf("test scores are Invalid");
}
Explanation:
<u>Following are the description of the code.</u>
In the following code that is written in the C Programming Language.
- Set an integer data type variable i.e., score.
- Then, set the if conditional statement to check the condition is the variable "score" is greater than 0 and less the 100.
- If the following statement is true then print "Valid test scores".
- Otherwise, it print "test scores are Invalid".