import java.util.Scanner;
public class homework {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
// 阶乘题
Scanner in=new Scanner(System.in);
int n=in.nextInt();
int sum=1,t=0;
for (int i = 1; i <=n; i++) {
sum=sum*i;
t+=sum;
}
in.close();
System.out.println(sum);
System.out.println(t);
//斐波那契数列分数
/*double a = 1, b = 1, sum = 0, zi=0, mu=0;
for (int i = 0; i < 20; i++) {
zi = a + b;
mu = b;
sum += zi / mu;
a = b;
b = zi;
}
System.out.println(sum);*/
//经典兔子问题,1 1 2 3
/*int i,a=1,b=1,sum=0;
int n=in.nextInt();
if(n>2){
for(i=3;i<=n;i++){
sum=a+b;
a=b;
b=sum;
}
System.out.println("一共"+2*sum+"只兔子");
}else{
System.out.println("一共2只兔子");
}*/
//九九乘法表
/*int i,j;
for(i=1;i<=9;i++){
for(j=1;j<=i;j++){
System.out.print(i+"*"+j+"="+i*j+" ");
}
System.out.println();
}*/
//比较价格
/*int i=1;
System.out.print("第"+i+"家店的价格是:");
int j = in.nextInt();
for(i=2;i<=4;i++){
System.out.print("第"+i+"家店的价格是:");
int n=in.nextInt();
if(n<j){
j=n;
}
}
System.out.println("最低价格是"+j);
*/
}
}
160730
最新推荐文章于 2021-12-24 13:55:21 发布