Computer Science, asked by vanadiumtygaming, 4 months ago

What will be output of following code? inta=6; intb=8; if(a>b) System.out.println(a); else System.out.println(b);

Answers

Answered by sohan7c12
1

Answer:

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);

Explanation:

Similar questions