0
Hi all, I have a confusion in the below java code and don't know how I can correct it
//To EXPRESS days into years,months, and days..... import java. io.*; public class days { public static void main(String args[])throws IOException { int a,b,c,y,d; Input StreamReader Read = new Input StreamReader(System.in); BufferedReader in = new BufferedReader(read); int a,b,c,y,d; System.out.println("Enter number of days"); a=Integer.parseInt(in.readLine()); y=a/365; b=a%365; c=b/30; d=b%30; System.out.println("The no. of years="+y); System.out.println("The no. of months="+c); System.out.println("The no. of days="+d); } }
2 ответов
+ 1
Here is your code
https://code.sololearn.com/c21lT5bEhBvB/?ref=app
InputStreamReader should be one word. And you have duplicated definitions of your int variables. Next time define and initialize in one line, like
int y = a / 365;
int b = a % 365;
0
Aleksandrs Kalinins thank you so much😊. I was literally breaking my head on this for days😶