Looping in loping, can someone explain me | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Looping in loping, can someone explain me

#include <iostream> using namespace std; int main() { int a; cout <<"Masukan tinggi segitiga : "; cin >> a; for(int b = 0;b <=a ;b++){ for(int c = 1 ;c <= b;c++){ cout<<"* "; }cout <<endl; } }

14th Dec 2019, 9:23 AM
Rrrrrr
Rrrrrr - avatar
3 Answers
+ 1
If you know, loop execution, then it happens as first inner executed in no.of times the outer loop need to be executed, for your program, it is until b<=a fails... Is it ok? Are you needed some more?
14th Dec 2019, 9:41 AM
Jayakrishna 🇮🇳
+ 1
Nestef looping. If there is a nedtef looping in your code. Two, three four five event more nested loop of nestefld condition, c++ and other language will execute the inner loop first.pay attention to the pair of bracket for nested loop or nested if {} like begin end block or repeat until.
16th Dec 2019, 10:34 PM
Oliver Pasaribu
Oliver Pasaribu - avatar
+ 1
For triagle looping please check one by one per linem use for repeatedly in each line them do simplification to eliminate redundant for clausem believeml me you will find the same answer
16th Dec 2019, 10:36 PM
Oliver Pasaribu
Oliver Pasaribu - avatar