code is showing error. what is error..help me to fix it.. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

code is showing error. what is error..help me to fix it..

https://code.sololearn.com/cRK9J585hH37/?ref=app

16th Oct 2020, 9:17 AM
__n
__n - avatar
16 Answers
+ 6
__n I have already attached the fix code. Please check! :) Mmm. 👇 https://code.sololearn.com/cpQUTl9WC35v/?ref=app
16th Oct 2020, 12:53 PM
P∆WAN M∆URY∆
P∆WAN M∆URY∆ - avatar
+ 4
__n You are taking three input but your code consider only two. just because of loop it's just printing 2 times. with the same value. for example you entered : 2 1901 2000 but when it reaches the code: it's becomes like 2 1901 And due to for loop : it's printing no no because the value is 1901. How to fix ? so you have to take input inside for loop. please check this code. it will help you. https://code.sololearn.com/cpQUTl9WC35v/?ref=app
16th Oct 2020, 12:05 PM
P∆WAN M∆URY∆
P∆WAN M∆URY∆ - avatar
+ 4
__n Your scanf is not present in loop so. It's ignoring your 2012. You are providing value of N only one time. But it's should be two times. if T is 2. Or you can override value of N Within loop.
16th Oct 2020, 12:40 PM
P∆WAN M∆URY∆
P∆WAN M∆URY∆ - avatar
+ 3
You can't chain the condition like 1 <= T <= 10. It will be read as (1 <= T) <= 10. Saying T is 0. 1 <= T returns 0(false) 0<=10 returns 1(true). You have to separate it with &&. if(1<=T && T <=10)
16th Oct 2020, 9:28 AM
你知道規則,我也是
你知道規則,我也是 - avatar
+ 3
__n Pleasure of mine. :)
16th Oct 2020, 12:59 PM
P∆WAN M∆URY∆
P∆WAN M∆URY∆ - avatar
+ 2
CarrieForle yes but if we takeT that is test cases as 2 then ??? take input 2 1900 2012
16th Oct 2020, 12:34 PM
__n
__n - avatar
+ 2
P∆WAN M∆URY∆ then how i do it??
16th Oct 2020, 12:46 PM
__n
__n - avatar
+ 2
P∆WAN M∆URY∆ thank u so much☺👍
16th Oct 2020, 12:55 PM
__n
__n - avatar
+ 1
yes,but there is also one problem that for year which is not a leap its showing it is leap year(Yes)..
16th Oct 2020, 9:36 AM
__n
__n - avatar
+ 1
A leap year is divisible by 4, not 2.
16th Oct 2020, 11:29 AM
你知道規則,我也是
你知道規則,我也是 - avatar
+ 1
still its showing same
16th Oct 2020, 11:32 AM
__n
__n - avatar
+ 1
How do you input? I input 1 2020 and it prints yes. If I input 1 2019 it prints no.
16th Oct 2020, 11:37 AM
你知道規則,我也是
你知道規則,我也是 - avatar
+ 1
P∆WAN M∆URY∆ i think there was problem in ur code...in conditions of if .. i uploaded this.. now this is correct.. https://code.sololearn.com/cluz4AO80mKG/?ref=app
16th Oct 2020, 3:04 PM
__n
__n - avatar
+ 1
__n ... What was the problem ?
16th Oct 2020, 3:11 PM
P∆WAN M∆URY∆
P∆WAN M∆URY∆ - avatar
+ 1
if(1<=T && 10>=T && 1<=N && 2500>=N) if(N%4==0 && (N%100!=0 || N%400==0)) this conditions ...
16th Oct 2020, 4:16 PM
__n
__n - avatar
17th Oct 2020, 6:14 PM
Siriki Lohit