P1039 谭浩强C语言(第三版)习题4.9
import java.util.*;
import java.io.*;
import java.math.BigInteger;
public class Main
{
public static void main(String args[])
{
Scanner cin=new Scanner(System.in);
double f=cin.nextDouble();
System.out.printf("c=%.2f
",5*(f-32)/9);
}
}
P1040 谭浩强C语言(第三版)习题5.4
import java.util.*;
import java.io.*;
import java.math.BigInteger;
public class Main
{
public static void main(String args[])
{
Scanner cin=new Scanner(System.in);
int a=cin.nextInt(),b=cin.nextInt(),c=cin.nextInt();
if(a<b) a=b;
if(a<c) a=c;
System.out.println(a);
}
}
P1041 谭浩强C语言(第三版)习题5.5
import java.util.*;
import java.io.*;
import java.math.BigInteger;
public class Main
{
public static void main(String args[])
{
Scanner cin=new Scanner(System.in);
int x=cin.nextInt();
if(x>=1)
{
if(x<10) x=x*2-1;
else x=3*x-11;
}
System.out.println(x);
}
}
P1042 谭浩强C语言(第三版)习题5.6
import java.util.*;
import javax.lang.model.util.ElementScanner6;
import java.io.*;
import java.math.BigInteger;
public class Main
{
public static void main(String args[])
{
Scanner cin=new Scanner(System.in);
int x=cin.nextInt();
if(x>=90)
System.out.println("A");
else if(x>=80)
System.out.println("B");
else if(x>=70)
System.out.println("C");
else if(x>=60)
System.out.println("D");
else
System.out.println("E");
}
}
P1043 谭浩强C语言(第三版)习题5.7
import java.util.*;
import java.io.*;
import java.math.BigInteger;
public class Main
{
public static void main(String args[])
{
Scanner cin=new Scanner(System.in);
int x=cin.nextInt(),cnt=0;
int[] arr=new int[10];
do
{
arr[cnt++]=x%10;
x/=10;
}
while(x!=0);
System.out.println(cnt);
for(int i=cnt-1;i>=0;--i)
{
if(i==0)
System.out.print(String.valueOf(arr[i])+'
');
else System.out.print(String.valueOf(arr[i])+' ');
}
for(int i=0;i!=cnt;++i)
{
System.out.print(arr[i]);
}
}
}