+ 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 Respuestas
+ 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
minirkk
minirkk - avatar
+ 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