Output Questions for Class 10 ICSE Computer Applications
Predict the output of the given snippet, when executed:
int b=3,k,r;
float a=15.15,c=0;
if(k==1)
{
r=(int)a/b;
System.out.println(r);
}
else
{
c=a/b;
System.out.println(c);
Java
Input in Java
57 Likes
Answer
Syntax Error
Working
There are 2 syntax errors in this program:
- Variable k is not initialized with any value before using it in the if check.
- The closing curly brace is missing for the compound statement block of else part.
Answered By
36 Likes