Computer Science, asked by anuragsingh090, 7 months ago

Write the following code using switch case construct:- int a,b=10; if (a== 100) { b+= 5 ; System.out.print(b) ; } else { b* = a ; System.out.print(b) ; }

Answers

Answered by Liyutsararename
0

its coming as variable a might not have been initialized so i took a from user........

import java.util.Scanner;

class SWITCH22

{

public static void main(String[] args)

{

Scanner sc = new Scanner(System.in);

System.out.println("enter a:");

int a = sc.nextInt();

int b=10;

switch(a){

case 100:

b+=5 ;

System.out.print(b) ;

break;

default:

b=b*a ;

System.out.print(b);

}

}

}

HOPE THIS HELPS YOU !

PLEASE MARK AS BRAINLIEST AND FOLLOW ME TOO!

Explanation:

Similar questions