If n value is 5 ,the output should be 1 2 3 4 5 ,n value should be given by the users only, use any condition loops. | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 2

If n value is 5 ,the output should be 1 2 3 4 5 ,n value should be given by the users only, use any condition loops.

7th Apr 2020, 2:41 PM
PŕiňcĆ© Å”Ć£hĆŗł
PŕiňcĆ© Å”Ć£hĆŗł - avatar
2 Respostas
+ 2
Try this(while loop) #include <iostream> using namespace std; int main(){ int i = 1; int n = 5; while( i<=n){ cout<<"Value of variable i is: "<<i<<endl; i++; } return 0; }
7th Apr 2020, 8:14 PM
Rohit
+ 1
Try this #include <iostream> using namespace std; int main(){ for(int i=1; i<=6; i++){ cout<<"Value of variable i is: "<<i<<endl; } return 0; }
7th Apr 2020, 2:53 PM
Ayush Kumar
Ayush Kumar - avatar