Plz help to find the error | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Plz help to find the error

#include <stdio.h> int main() { int i; for(i=1;i>11;++i) { printf("%d",i); } return 0; }

2nd Aug 2020, 7:39 AM
Chittaranjan behera
Chittaranjan behera - avatar
6 Answers
+ 7
*It'll be i < 11. * (not i >11, as the loop is false here.)
4th Aug 2020, 5:00 AM
Priya Sharma :)
Priya Sharma :) - avatar
+ 4
Chittaranjan behera you won't get output. Because your condition in For loop is already false so it won't satisfies the condition Which results in no output. See this below code. I hope this will help you:) https://code.sololearn.com/cL85YCEU58M1/?ref=app
2nd Aug 2020, 7:50 AM
Yogeshwaran P
Yogeshwaran P - avatar
+ 4
Just quick tips on how to manage and fix problems like this - 1) Doing DRY CODE with pencil and paper really help to fix or find the bug or typo. 2) Putting a print statement inside the for loop to see whether the loop's condition is working properly is another way to find the error.
2nd Aug 2020, 7:53 AM
Rohit Kh
Rohit Kh - avatar
+ 2
Thanks a lot 😘
2nd Aug 2020, 7:45 AM
Chittaranjan behera
Chittaranjan behera - avatar
+ 1
Thank you
2nd Aug 2020, 7:51 AM
Chittaranjan behera
Chittaranjan behera - avatar
0
Its need to be i < 11
3rd Aug 2020, 7:53 PM
Panda🐼🐼🐼
Panda🐼🐼🐼 - avatar