I'm trying to have this simple code for while looping so that i could have an output of "I love this!" but its results to error | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

I'm trying to have this simple code for while looping so that i could have an output of "I love this!" but its results to error

#include<stdio.h> int main() int n=0; while (n<5) { printf ("I love this!\n"); n++; }

20th Feb 2021, 5:54 AM
Eirol Tulio
Eirol Tulio - avatar
6 Answers
+ 3
// 'main' function definition lacks curly brackets: #include<stdio.h> int main() { int n=0; while (n<5) { printf ("I love this!\n"); n++; } }
20th Feb 2021, 6:06 AM
visph
visph - avatar
+ 1
you are missing "{ }", for int main(). should be. int main() { //your code while{ //your code } return 0 ; }
20th Feb 2021, 6:07 AM
Bahhaⵣ
Bahhaⵣ - avatar
+ 1
you're right ;)
20th Feb 2021, 6:13 AM
visph
visph - avatar
0
Thanks! Gahhhddd totally forgot the simplest thing to include!
20th Feb 2021, 6:08 AM
Eirol Tulio
Eirol Tulio - avatar
0
Correct me if I'm wrong😊
20th Feb 2021, 6:12 AM
Eirol Tulio
Eirol Tulio - avatar
0
Thanks!
20th Feb 2021, 6:14 AM
Eirol Tulio
Eirol Tulio - avatar