Computer Science, asked by Saujanyatiwari, 6 months ago

HEY FRIENDS....

CAN ANYONE PLS HELP ME WITH THIS ACTUALLY WHILE I WAS CODING I CAME IO WITH THIS PROGRAM WHAT SHALL I DO KNOW WHEN I COMPILE IT THIS COMES AS SHOWN IN PICTURE.....


WRONG AND IRRELEVANT ANSWERS WILL BE REPORTED.......WHEREAS THE CORRECT ONES WOULD BE MARKED BRAINLIEST......I' LL FOLLOW EVEN......BUT MAKE SURE FIRSTLY I RUN THE PROGRAM .......​

Attachments:

Answers

Answered by AnindaBasu
1

Answer:

you should declare the int s at the top of the program where u used int a; in there you can use the error you are getting is because the scope of the variable int s is limited to that for loop. That's y java cannot find the value after the loop where you have written

Similar questions