I am running through the lessons, can this be simplified, multiples of 3 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

I am running through the lessons, can this be simplified, multiples of 3

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

18th Dec 2020, 2:04 PM
Steven Gough
2 Answers
0
Improvements can be done in lot of ways.. It's may different from different persons so comes to opinion based so better to use feed post for these kind of questions.. One way : Use if (x%3==0) directly instead of declaring c.. Else starts from x=0 and without if part print by increasing x=x+3..
18th Dec 2020, 2:41 PM
Jayakrishna 🇮🇳
0
Thanks for the input. I was able to remove the c declaration. Still new to this. Was able to piece together the above solution now was looking to get some input from more experienced users. Best way to learn I think.
18th Dec 2020, 3:29 PM
Steven Gough