用c语言,给你给了A,B,N这些数字,AX数被N除时,余数为B的情况且 0小于等于x小于等于n-1
答案:1 悬赏:30
解决时间 2021-01-19 18:28
- 提问者网友:人生佛魔见
- 2021-01-19 05:04
用c语言,给你给了A,B,N这些数字,AX数被N除时,余数为B的情况且 0小于等于x小于等于n-1
最佳答案
- 二级知识专家网友:深街酒徒
- 2021-01-19 05:54
#include "windows.h"
#include "stdio.h"
#define BLOCK_NUM3
void main()
{
int nA = 0, nB = 0, nN = 0;
while(TRUE)
{
printf("输入数A:");
scanf("%d", &nA);
printf("输入数B:");
scanf("%d", &nB);
printf("输入数N:");
scanf("%d", &nN);
// 判断输入正确性
if(0 <= nN && nN <= 100000 && 0 <= nA && nB < nN)
{
break;
}
printf("输入数字不正确,请重新输入
");
}
printf("满足的X值有:");
for(int x = 0; x < nN; x++)
{
if( (nA*10 + x) % nN == nB)
{
printf("%d ", x);
}
}
printf("
");
system("pause");
}
#include "stdio.h"
#define BLOCK_NUM3
void main()
{
int nA = 0, nB = 0, nN = 0;
while(TRUE)
{
printf("输入数A:");
scanf("%d", &nA);
printf("输入数B:");
scanf("%d", &nB);
printf("输入数N:");
scanf("%d", &nN);
// 判断输入正确性
if(0 <= nN && nN <= 100000 && 0 <= nA && nB < nN)
{
break;
}
printf("输入数字不正确,请重新输入
");
}
printf("满足的X值有:");
for(int x = 0; x < nN; x++)
{
if( (nA*10 + x) % nN == nB)
{
printf("%d ", x);
}
}
printf("
");
system("pause");
}
我要举报
如以上问答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯