Created
January 6, 2015 14:49
-
-
Save takanakahiko/51df19327baceb579386 to your computer and use it in GitHub Desktop.
コサイン波の観測。ゲームとかのふわふわ表現に使えるやつね。(1.6)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class CosWave{ | |
public static void main(String[] args){ | |
int n = Integer.parseInt(System.console().readLine("いくつまでやりますか? ->")); | |
double PI = 3.14; | |
for(int i = 0; i < n; i ++){ | |
try{ | |
Thread.sleep(100); | |
}catch(InterruptedException e){} | |
int m = 10+(int)(10*Math.cos(PI*i/10)); | |
for(int j = 0; j < m; j++) | |
System.out.print(" "); | |
System.out.println("*"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment