C++ examples for Statement:for
Drawing Patterns with Nested for Loops 1
* ** *** **** ***** ****** ******* ******** ********* **********
#include <iostream> int main(int argc, const char *argv[]) { for (int i = 1; i <= 10; i++) { for (int j = 1; j <= 10; j++) { std::cout << ((j <= i) ? '*' : ' '); }/*from w w w . j ava 2s . c o m*/ std::cout << std::endl; } return 0; }