if语句的运用
来源:互联网 发布:上海乐其网络怎么样 编辑:程序博客网 时间:2024/05/16 15:47
单向if语句:
//判断从键盘输入的数的奇偶
import java.util.Scanner;
public class Study1 {
public static void main(String[]args){
Scanner input =new Scanner (System.in);
System.out.print("Enter the number1 is ");
int number1=input.nextInt();
if (number1 % 2==0){
System.out.print("The number1 " +number1 + " is 偶数");}
if (number1 % 2==1){
System.out.print("The number1 " +number1 + " is 奇数");}
}}
双向if语句:
//判断从键盘输入的数的奇偶
import java.util.Scanner;
public class Study1 {
public static void main(String[]args){
final double IP=3.14159;
Scanner input =new Scanner (System.in);
System.out.print("Enter the number1 is ");
double number1=input.nextDouble();
double number2 =number1%2;
if (number2==0){
System.out.print("The number1 " +number1 + " is 偶数");}
else {
System.out.print("The number1 " +number1 + " is 奇数");}
}}
- if语句的运用
- if 语句的运用
- python中if语句的运用
- if语句运用
- 5.9运用if-else语句
- dedecms {dede:datalist}标签下,if语句的运用!
- if语句和if else语句简单运用
- smarty模板if语句整体运用
- if语句运用和switch初入
- 新手.双向if语句简单运用
- 【尚学堂之行——第四天】Java编程之if...else if...else判断语句的简单运用
- dede 模板 if dedecms模板中运用dede标签时使用php和if判断语句的方法
- c语言-if的运用
- if...elseif...else 的运用
- 如何运用IF语句把数据插入到不同的表中?
- if语句的运用:用C语言解决奖金发放和出租车费问题。
- ASP的IF语句
- if 语句的优化
- 写给自己
- super和this的使用
- 把握linux内核设计思想(九):进程调度
- gb2312网页转码输出utf-8格式文本
- Mysql Client
- if语句的运用
- CentOS 7 下的MySQL安装以及C连接MySQL
- 学习hibernate遇到的问题1
- WebService常见问题
- 【HTTP】URL与资源
- mongodb与mysql命令对比
- Objective-C类和对象
- xcode6 ios ios simulator Home键
- [记录]学习<<QT学习之路2>>第四天