+ 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; } }
3 Antworten
+ 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?
+ 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.
+ 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