+ 2

Floyd's triangle code using c++

#include <iostream> using namespace std; int main( ) { int rows, number = 1; cout << "Enter number of rows: "; cin >> rows; for(int i = 1; i <= rows; i++) { for(int j = 1; j <= i; ++j) { cout << number << " "; ++number; } cout << endl; } return 0; }

17th Jun 2018, 2:20 AM
Noman Aasif
Noman Aasif - avatar
1 Réponse
+ 4
change line after cin..
17th Jun 2018, 7:19 AM
Ishan
Ishan - avatar