Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Perl to Java

Name: Anonymous 2012-02-22 11:29

How would this perl code look like in Java?

http://pastebin.com/GPzQFxPL

Name: FEAR_MY_TRIANGLE 2012-02-22 19:29


#include <iostream>
using namespace std;

int main(void)
{
    int r, c;
    int n = 9;
   
    for (r = 1; r <=n; r++, cout << endl)
        for (c = 1; c <=n; c++)
            cout << (r == 1 || r == n ||
                 (r <= c && r + c <= n + 1) ||
                 (r >= c && r + c >= n + 1 ) ? '*' : ' ');
   
    return 0;  
}

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List