C语言趣味程序百例绘制余弦曲线public class test1{
public static void main(String args[])
{double y;
double x, m;
for (y=1;y>-1;y-=0.1) {
m= Math.acos(y) * 10;
for (x = 1; x < m; x++)
System.out.print(" ");
System.out.print("*");
for (; x < 62 - m; x++)
System.out.print(" ");
System.out.println("*");
}
}
}
C语言趣味程序百例绘制圆public class test3{
public static void main(String args[])
{double y;
double x, m;
for(y=10;y>=-10;y--){
m=2*Math.sqrt(100-y*y);
for(x=1;x<30-m;x++)
System.out.print(" ");
System.out.print("*");
for(;x<30+m;x++)
System.out.print(" ");
System.out.println("*");
}
}
}
C语言趣味程序百例(4)歌星评分import java.util.*;
public class test4{
public static void main(String args[]){
int max=0;
int min=100;
double sum=0;
for(int i=1;i<=10;i++){
System.out.printf("请输入第"+i+"个分数:\n");
Scanner reader=new Scanner(System.in);
int x=reader.nextInt();
sum+=x;
if(x> max) max=x;
if(x< min) min=x;
}
System.out.println("无效的最高分和最低分:"+max+" , "+min);
System.out.println("最后选手的得分是:"+(sum-max-min)/8.0);
}
}
C语言趣味程序百例求最大约数public class test5{
public static void main(String args[]){
for (int i=999;i>99;i--) {
if (555555%i==0) {
System.out.println("最大约数="+i);
return;
}
}
}
}
C语言趣味程序百例(12)抓交通肇事犯public class test12{
public static void main(String args[]){
int k;
for(int i=1;i<=9;i++){
for(int j=0;j<=9;j++){
if(i!=j){
k=i*1000+i*100+j*10+j;
for(int c=31;c< 100;c++){
if(c*c==k)
System.out.println("肇事车牌号是"+k);
}
}
}
}
}
}
C语言趣味程序百例(38)换分币public class test38{
public static void