#include <iostream> using std::cout; using std::cin; using std::endl; void draw(char, char); int main(void) { char a, b; cin>>a>>b; draw(a, b); return 0; } void draw(char begin, char end) { for(int i=0; i<= (end-begin); i++) { for(int j=0; j<=i; j++) { cout<<(char)(begin+j); } cout<<endl; } }
심심하군요
실행 결과 ¶
Input:
AZ
AZ
Output:
A
AB
ABC
ABCD
ABCDE
ABCDEF
ABCDEFG
ABCDEFGH
ABCDEFGHI
ABCDEFGHIJ
ABCDEFGHIJK
ABCDEFGHIJKL
ABCDEFGHIJKLM
ABCDEFGHIJKLMN
ABCDEFGHIJKLMNO
ABCDEFGHIJKLMNOP
ABCDEFGHIJKLMNOPQ
ABCDEFGHIJKLMNOPQR
ABCDEFGHIJKLMNOPQRS
ABCDEFGHIJKLMNOPQRST
ABCDEFGHIJKLMNOPQRSTU
ABCDEFGHIJKLMNOPQRSTUV
ABCDEFGHIJKLMNOPQRSTUVW
ABCDEFGHIJKLMNOPQRSTUVWX
ABCDEFGHIJKLMNOPQRSTUVWXY
ABCDEFGHIJKLMNOPQRSTUVWXYZ
A
AB
ABC
ABCD
ABCDE
ABCDEF
ABCDEFG
ABCDEFGH
ABCDEFGHI
ABCDEFGHIJ
ABCDEFGHIJK
ABCDEFGHIJKL
ABCDEFGHIJKLM
ABCDEFGHIJKLMN
ABCDEFGHIJKLMNO
ABCDEFGHIJKLMNOP
ABCDEFGHIJKLMNOPQ
ABCDEFGHIJKLMNOPQR
ABCDEFGHIJKLMNOPQRS
ABCDEFGHIJKLMNOPQRST
ABCDEFGHIJKLMNOPQRSTU
ABCDEFGHIJKLMNOPQRSTUV
ABCDEFGHIJKLMNOPQRSTUVW
ABCDEFGHIJKLMNOPQRSTUVWX
ABCDEFGHIJKLMNOPQRSTUVWXY
ABCDEFGHIJKLMNOPQRSTUVWXYZ
Input:
cq
cq
Output:
c
cd
cde
cdef
cdefg
cdefgh
cdefghi
cdefghij
cdefghijk
cdefghijkl
cdefghijklm
cdefghijklmn
cdefghijklmno
cdefghijklmnop
cdefghijklmnopq
c
cd
cde
cdef
cdefg
cdefgh
cdefghi
cdefghij
cdefghijk
cdefghijkl
cdefghijklm
cdefghijklmn
cdefghijklmno
cdefghijklmnop
cdefghijklmnopq
Input:
39
39
Output:
3
34
345
3456
34567
345678
3456789
3
34
345
3456
34567
345678
3456789
Input:
98
98
Output:
(없음)
(없음)