Microsoft exle also can do the same.
Write a program to print any name 20000 times without using loops and recurssive function and that to in java?
I'm a C++ guy, not a Java guy, so I don't know the function names you would use, but you should do it by adding a string to itself.
32 * 625 = 20000
2 * 2 * 2 * 2 * 2 = 32
5 * 5 * 5 * 5 = 625
So here's my pseudo code:
string s( name );
s = s + s + s + s + s; // 1 * 5 = 5
s = s + s + s + s + s; // 5 * 5 = 25
s = s + s + s + s + s; // 25 * 5 = 125
s = s + s + s + s + s; // 125 * 5 = 625
s = s + s + s + s; // 625 * 4 = 2500
s = s + s + s + s; // 2500 * 4 = 10000
s = s + s; // 10000 * 2 = 20000
print( s );
Reply:You should do your own homework. It is really easy. You have a use of a counter, if statement and what is the last thing you need?
performing arts
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment