give the solution of the program int i; for(i=5;i>10;i++) System.out.println(i); System.out.println(i*4);
Answers
Question1. What will be the output of the
following programs? Give reasons. [4, 7, 4]
No credit will be given if you do not give reasons
(even if your output is correct). Also, if the
reasoning is wrong then you will not get any
credit for just writing the correct output.
class q1a{
public static void sumUp(int n, int total){
int i;
for (i=1; i<=n; i++){
total = total +i;
}
}
public static void main(String args[]){
int n, total;
n=10; //n can be initialized to any +ve number
total=0;
sumUp(n, total);
System.out.println(total);
}
}
Answer:
n=10; //n can be initialized to any +ve number total=0;. sumUp(n, total);. System.out.println( total);. } } class point{ int p,q; point(int p, int q){ ... Answer: The program will not ...