下载此文档

java程序.doc


文档分类:办公文档 | 页数:约7页 举报非法文档有奖
1/7
下载提示
  • 1.该资料是网友上传的,本站提供全文预览,预览什么样,下载就什么样。
  • 2.下载该文档所得收入归上传者、原创者。
  • 3.下载的文档,不会出现我们的网址水印。
1/7 下载此文档
文档列表 文档介绍
+1/2+1/3+……+1/10
public class fenshu{
public static void main(String[] args) {
   int i=1;
   double a=1;
   double sum=0;
   while(i<=10){
    sum+=a;
    i++;
                        a=;
   }
   ("sum= "+ sum);
        }
}
:90~100:A……1~59:E,其他:F
import ;
public class greed{
public static void main(String[] args){
   Scanner scanner =new Scanner();
   int x=();            
   if((x>=90)&&(x<=100)){
    ("A ");
   }else if ((x>=80)&&(x<=89)){
    ("B ");
   }else if( (x>=70)&&(x<=79)){
    ("C");
   }else if ((x>=60)&&(x<=69)){
    ("D");
                }else if ((x>=0)&&(x<=59)){
    ("E");
   }else {
    ("F" );
                }
}
}    
3.   从键盘输入一个数,判断奇偶
import ;
public class jioushu {
public static void main(String[] args){
   Scanner scanner =new Scanner();
   int x=();
   for(int i=1;i<x;i++){
    if(x%2==0){
                                (""+x+"是个偶数");
                 break;
    }
    else{
     (""+x+"是个奇数");
     break;
                  }
                }
}
}     
+3+5+……+99的和
public class sub{
public static void main(String[] args) {
       

java程序 来自淘豆网m.daumloan.com转载请标明出处.

相关文档 更多>>
非法内容举报中心
文档信息
  • 页数7
  • 收藏数0 收藏
  • 顶次数0
  • 上传人xunlai783
  • 文件大小38 KB
  • 时间2018-03-10