c程序设计(急 在线等!!)
来源:百度知道 编辑:UC知道 时间:2024/09/27 09:20:30
明天就要!!!!!!
1。输入整数a和b,若a²+b²>140则输出a²+b²百位以上的数字,否则输出2数字之和。
2。判断输入的正整数是否既是5又是7的倍数的整倍数。若是输出yes不是输出no
3。输入一整数,判断能否被3,5,7整除,输出下列之一:
a.能同时被3 5 7整除
b.能同时被其中俩数(指出那两数)整除。
c.能被其中一个数(指出那个数)整除
d.不能被任意数整除。
谢谢各位高人!有加分!!!!
PS 刚学完if esle那块,所以程序不用太复杂~~~~谢谢~~~~
1。输入整数a和b,若a²+b²>140则输出a²+b²百位以上的数字,否则输出2数字之和。
2。判断输入的正整数是否既是5又是7的倍数的整倍数。若是输出yes不是输出no
3。输入一整数,判断能否被3,5,7整除,输出下列之一:
a.能同时被3 5 7整除
b.能同时被其中俩数(指出那两数)整除。
c.能被其中一个数(指出那个数)整除
d.不能被任意数整除。
谢谢各位高人!有加分!!!!
PS 刚学完if esle那块,所以程序不用太复杂~~~~谢谢~~~~
第一题:
#include <stdio.h>
main()
{ int a,b;
int c;
printf("please input the first number: ");
scanf("%d",&a);
printf("please input the second number: ");
scanf("%d",&b);
if((c = (a*a)+(b*b)) > 140)
printf("output1):%d\n",c/100);
else
printf("output2:%d\n",a+b);
}
第二题:
#include <stdio.h>
main()
{ int a;
printf("please input a number: ");
scanf("%d",&a);
if(((a%5) == 0 )&& ((a%7) == 0))
printf("yes\n");
else
printf("no\n");
}
第三题:
#include <stdio.h>
main()
{ int a;
printf("please input a number: ");
scanf("%d",&a);
if(((a%5) == 0 ) && ((a%7) == 0) && ((a%3) == 0))
printf("all of 3 and 5 and 7\n&q