给定两个整数a和b (0 < a,b < 10,000),计算a除以b的整数商和余数。
区块链毕设网qklbishe.com为您提供问题的解答
给定两个整数a和b (0 < a,b < 10,000),计算a除以b的整数商和余数。
while(l=readline()){ var arr=l.split(" "); var a=arr[0]; var b=arr[1]; console.log(parseInt(a/b)+" "+a%b); }
#include<stdio.h> int main() { int a,b; scanf("%d%d",&a,&b); printf("%d %d",a/b,a%b); return 0; }
#include<stdio.h> int main(void){ int a, b; scanf("%d %d", &a, &b); if(b != 0) printf("%d %dn", a/b, a%b); else printf("除数为0,Error"); return 0; }
//计算两个整数的商和余数 // #include<stdio.h> int main() { int a = 0; int b = 0; int c = 0; int d = 0; scanf("%d %d",&a, &b);//读入数据 //判断a和b的大小,让a的值始终较大 if(a < b) { c = a; a = b; b = c; } c = a/b; //计算商 c = (int)c; //把商转换成整数 d = a%b; //计算余数 printf("%d",c); printf(" "); //题目要求有空格 printf("%d",d); return 0; }
#include<stdio.h> int main() { int a=0; int b=0; scanf("%d %d",&a,&b); printf("%d %d ",a/b,a%b); }
int main()
{
int a=0;
int b=0;
scanf("%d %d",&a,&b);
int m=a/b;
int n=a%b;
printf("%d %d",m,n);
return 0;
}
int san(int x,int y){
return x/y;
}
int chu(int x,int y){
return x%y;
}
int main() {
int a =0;
int b =0;
scanf("%d %d",&a,&b);
san(a,b);
chu(a,b);
printf("%d ",san(a,b));
printf("%d",chu(a,b));
return 0;
}
#include<stdio.h>
int main()
{
int a = 0;
int b = 0;
scanf("%d", &a);
scanf("%d", &b);
printf("%dn%dn", a / b ,a % b);
return 0;
}
int main()
{
int a = 0, b = 0;
scanf_s("%d%d", &a, &b);
printf(" % d % d", a/b, a%b);
return 0;
}
import java.util.Scanner; public class Main { public static void main(String[] args){ Scanner sc = new Scanner(System.in); int a = sc.nextInt(); int b = sc.nextInt(); System.out.printf("%d %dn",a/b,a%b); } }
import java.util.Scanner; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); String s = sc.nextLine(); String[] ss = s.split(" "); int a = Integer.parseInt(ss[0]); int b = Integer.parseInt(ss[1]); System.out.printf("%d %d",a/b,a%b); } }
int main() { int a,b; scanf("%d %d",&a,&b); printf("%d %d",a/b,a%b); }
import java.util.Scanner; public class Main{ public static void main(String[] args){ Scanner scanner = new Scanner(System.in); int a=scanner.nextInt(); int b=scanner.nextInt(); System.out.println(a/b+" "+a%b); } }
int main()
{
int a, b;
printf("输入两个整数:");
scanf_s("%d%d", &a, &b);
int c, d;
c = a / b;
d = a % b;
printf("%d %d", c, d);
return 0;
}
#include<stdio.h>
int main() {
int a = 0;
int b = 1;
scanf("%d %d", &a, &b);
printf("%d %d", a/b, a%b);
}
int main()
{
int a=0, b=1;
scanf("%d %dn", &a,&b);
if (a>0&&b<1000&&b!=0)
{
int com=a/b;
int rem=a%b;
printf("%d %d",com,rem);
}
else {
printf("erorr!");
}
return 0;
}
int main() {
int a = 0;
printf("请输入一个整数:");
scanf("%d", &a);
int b = 1;
printf("请输入再一个整数:");
scanf("%d", &b);
if (a<1000&& b < 1000 && b != 0) {
int discuss = 0;
int remainder = 0;
discuss = a / b;
remainder = a % b;
printf("商为:%dt", discuss);
printf("余数为:%dt", remainder);
}
else
{
printf("错误");
}
}
int main() {
int a, b;
scanf("%d %d", &a, &b);
printf("%d %d", a / b, a % b);
return 0;
}
以上就是关于问题给定两个整数a和b (0 < a,b < 10,000),计算a除以b的整数商和余数。的答案
欢迎关注区块链毕设网-
专业区块链毕业设计成品源码,定制。
区块链NFT链游项目方科学家脚本开发培训