打印水仙花数
public class demo
{
public static void main(String[] args)
{
for(int i=100 ;i<=999; i++)
{
if( ((i%10)*(i%10)* (i%10)+(i/10%10)*(i/10%10)* (i/10%10)+(i/10/10)* (i/10/10)* (i/10/10) )==i)
{
System.out.print(“水仙花数:”+i+” , “);
}}}}
———————————————————————————————————————————-
九九乘法表
public class demo1
{
public static void main(String[] args)
{
int count=0;
for(int i=1 ;i<=9; i++)
{
for(int j=1;j<=i;j++)
{
System.out.print(j+”*”+i+”=”+(i*j)+” “);
}
System.out.println();
}}}
——————————————————————————–
纸张折叠成珠穆朗玛峰高度的次数
public class demo2
{
public static void main(String[] args)
{
int num=0;
int count= 8848 ;
int high=1;
do{
high = high*2;
num++;
}while(count>=high);
System.out.print(num)
大家看是没有效果的 ,最好平台上练练,这都是基础代码