www.sghz.net > print 两个整数

print 两个整数

C语言#inlcude<stdio.h> main() { int a,b t; printf("input a,b\n"); scanf("%d%d",&a,&b); if(a>b) t=a; else t=b; printf("%d\n",t) }

取整除 - 返回商的整数部分(向下取整)

int1=int(input('请输入一个整数:')) int2=int(input('请再输入一个整数:')) print('你输入的第一个整数是 %d ,第二个整数是 %d .' % (int1,int2))

print("请输入第一个整数")num1=input()print("请输入第二个整数")num2=input()print("输入的第一个整数是: %d,第二个整数是 :%d" % (num1,num2) )

#include int main() { int a,b; scanf("%d%d",&a,&b); a = a+b; b = a-b; a = a-b; printf("%d %d",a,b); return 0; }

import java.util.Scanner; public class Test { public static void main(String[] args){ Scanner sc=new Scanner(System.in); System.out.print("请输入第一个整数a:"); int a = sc.nextInt(); System.out.print("请输入第二个整数b:"); int b = sc.nextInt(); if(a%b==0) System.out.println("a能被b整除!"); else System.out.println("a不能被b整除!"); } }

if __name__ == '__main__': val1 = int(input("第一个整数:\n")) val2 = int(input("第二个整数:\n")) try: while(val1<val2): if(val1%2==0): val1+=1 else: print(val1) val1+=2 except Error as e: print(e)

#include "stdio.h" main() { int x,y; printf("请输入两个整数:"); scanf("%d%d",&x,&y); printf("x+y=%d\n",x+y); printf("x-y=%d\n",x-y); printf("x*y=%d\n",x*y); printf("x/y=%d\n",x/y); printf("x%y=%d\n",x%y); }

python 代码 a = int(raw_input("input a :")) b = int(raw_input("input b :")) if a > b: print a elif b > a: print b else: print "a=b %d" % a ……百度的空格 我醉了,请自己完善下吧,注意缩进~

#include <stdio.h> main() { int num1,num2; int x,y,z,k,j; print("num1=",num1); print("num2=",num2); x=num1+num2; y=num1-num2; z=num1*num2; k=num1/num2; j=num1%num2; print("和=",x); print("差=",y); print("积=",z); print("商=",k); print("余=",j); }

网站地图

All rights reserved Powered by www.sghz.net

copyright ©right 2010-2021。
www.sghz.net内容来自网络,如有侵犯请联系客服。zhit325@qq.com