cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
General C++ Programming
how to make this , i have no idea about
how to make this , i have no idea about nested loop
Oct 15, 2014 at 2:51am UTC
YEUNG
(2)
when i enter an integer 5 , two pattern just like the following would print
pattern 1
Pyramid A:
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
1 2 3 4
1 2 3
1 2
Pyramid B
5
4 4 4
3 3 3 3 3
2 2 2 2 2 2 2
1 1 1 1 1 1 1 1 1
Oct 15, 2014 at 2:56am UTC
YEUNG
(2)
for
1
12
123
1234
12345
int main()
{
int i , j , num ;
cout << "enter an integer (1-9):";
cin >> num
for (i=1, i<=num ; i++){
for (J=num;j>=1;j--){
if (j <= i)
cout <<j;
else
cout << " ";
}
}
return 0
}
but i don't know how to make through
1234
123
12
1
Oct 15, 2014 at 3:55am UTC
closed account (
48T7M4Gy
)
Modular arithmetic to the rescue, make use of the % function.
Topic archived. No new replies allowed.