Write a program to print the sum of n natural numbers | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Write a program to print the sum of n natural numbers

26th Oct 2023, 4:25 PM
RANJEET KUMAR VERMA
RANJEET KUMAR VERMA - avatar
5 Answers
+ 5
RANJEET KUMAR VERMA , To print the sum of n natural numbers, you will need use a `for loop` or a `while loop`. You need to learn again lessons... #introduction to c++ https://www.sololearn.com/learn/courses/c-plus-plus-introduction #For loop https://www.sololearn.com/learn/o-CPlusPlus/1616/?ref=app #while loop https://www.sololearn.com/learn/o-CPlusPlus/1617/?ref=app First try by yourself, after this if you face any problems during learning or making code ask again here...
26th Oct 2023, 5:59 PM
Darpan kesharwani🇮🇳[Inactive📚]
Darpan kesharwani🇮🇳[Inactive📚] - avatar
+ 2
RANJEET KUMAR VERMA It is not a place to provide readymade code. First try what you want to do yourself, then if you get stuck, ask here with your code. First of all you have to try it yourself then presenting here the issues you are facing hopefully everyone will help you with correct answers.
26th Oct 2023, 5:28 PM
EAJUDDIN
EAJUDDIN - avatar
0
But which loops are needed to create it
26th Oct 2023, 5:31 PM
RANJEET KUMAR VERMA
RANJEET KUMAR VERMA - avatar
0
RANJEET KUMAR VERMA it not chatGpt , it sololearn discussion section where you can ask doubt and problems you faced while making codes , so first try it by yourself and if you face any problem you can ask
27th Oct 2023, 6:34 AM
Alhaaz
Alhaaz - avatar
0
RANJEET KUMAR VERMA you can make it through any type of loop! loops in c++ :- i) for loop ii) while loop iii) do-while loop
27th Oct 2023, 6:35 AM
Alhaaz
Alhaaz - avatar