⑴ c语言中5!代表什么意思,怎么用c语言表示,求详解
c语言中没有5!,在数学中5!=5*4*3*2*1,用c语言编程:
#include<stdio.h>
intmain()
{
inti,s=1;
for(i=5;i>0;i--)
s*=i;
printf("%d ",s);
return0;
}
而c语言中!为非运算,!5=0,(任何!0的数都等于0)
⑵ 问555555的约数中最大的三位数是多少C语言怎么编写。
楼上修改版:
#include<stdio.h>
void main()
{
long a=555555;
for(n=999;n>=100;n--)
if (a%n==0)
{
printf("%d\n",n);
break;
}
}
⑶ 请教高手,用C语言编程求555555的约数中最大的三位数是多少
#include <stdio.h>
int main () {
int n = 555555, temp = 999;//让n为555555,把temp置为最大的三位数
while (temp > 1) {
if (n % temp == 0 && temp >= 100) //如果temp能被n整除(也就是说temp是n的约数),并且temp大于100(保证它是三位数)
break; //符合上一行提到的条件就跳出
temp -= 2; //否则就把temp减2(这是因为n是奇数,所以约数也只可能是奇数,这样能减少一半左右的计算量)
}
if (temp == 1) //如果temp等于1,那说明没有找到符合条件的
printf("Don't find.\n");
else //找到符合条件的,打印
printf("%d\n", temp);
}
⑷ 简单的C语言编程问题
switch是可以用的。一直用switch括号里面写上你的条件一直用CASE 1和IF没什么区别。还麻烦很多,这个就用IF做就很好了,之所以出现这种情况是因为你把2个整数相除之后的值给了rate有2种方法可以解决。,第一种比如rate=3/100直接写成0.03.第二种用强制转换rate=(double)3/100。程序我改了下。你可以看下。
#include<stdio.h>
int main()
{
double tax,salary,dection,rate;
scanf("%lf",&salary);
if(salary<=3500)
{
rate=0;
dection=0;
}
else if(salary<=5000&&salary>3500)
{
rate=0.03;
dection=0;
}
else if(salary<=8000&&salary>5000)
{
rate=0.10;
dection=105;
}
else if(salary<=12500&&salary>8000)
{
rate=0.20;
dection=555;
}
else if(salary<=38500&&salary>12500)
{
rate=0.25;
dection=1005;
}
else if(salary<=58500&&salary>38500)
{
rate=(double)30/100;
dection=2755;
}
else if(salary<=83500&&salary>58500)
{
rate=(double)35/100;
dection=5505;
}
else if(salary<=83500)
{
rate=(double)45/100;
dection=13505;
}
tax=rate*(salary - 3500)- dection;
printf("%.2f\n",tax);
return 0;
}
希望可以帮到你,望采纳。谢谢啦~~
⑸ C语言问题!急用!!速求!!
#include <stdio.h>
int main()
{
int max = 0;
for(int i=999;i>=100;i--)
{
if(555555%i==0)
{
max = i;
break;
}
}
printf("%d\n",max);
getchar();
}
答案:777
⑹ color(500,480,555);在c语言 里是什么意思呢
函数名: circle 功 能: 在给定半径以(x, y)为圆心画圆 用 法: void far circle(int x, int y, int radius); 程序例: #include <graphics.h> #include <stdlib.h> #include <stdio.h> #include <conio.h> int main(void) { /* request auto detection */ int gdriver = DETECT, gmode, errorcode; int midx, midy; int radius = 100; /* initialize graphics and local variables */ initgraph(&gdriver, &gmode, ""); /* read result of initialization */ errorcode = graphresult(); if (errorcode != grOk) /* an error occurred */ { printf("Graphics error: %s\n", grapherrormsg(errorcode)); printf("Press any key to halt:"); getch(); exit(1); /* terminate with an error code */ } midx = getmaxx() / 2; midy = getmaxy() / 2; setcolor(getmaxcolor()); /* draw the circle */ circle(midx, midy, radius); /* clean up */ getch(); closegraph(); return 0; }
我复制的
⑺ 用c语言编写程序求出555555的约数中最大的三位数是多少。 要求:用子函数求出所有的三位数约数及最大三位数
供参考……
#include "stdio.h"
void main(void){
int n=555555,i;
for(i=999;i>99;i-=2)
if(!(n%i)){
printf("%d的最大3位约数是%d\n",n,i);
break;
}
if(i<=99) printf("%d没有3位约数...\n",n);
}
⑻ 编辑程序求555555的约数中的最大三位数
代码:
#include<iostream>
using namespace std;
void func(int v)
{
int i, max;
cout <<v<<"的三位约数有:";
for(i = 100; i < 1000; i ++)
if(v%i == 0)
{
cout << i << ' ';
max = i;
}
cout<<"\n最大的为"<< max<< endl;
}
int main()
{
func(555555);
}
运行结果
555555的三位约数有:105 111 143 165 185 195 231 259 273 385 407 429 455 481 555 715 777
最大的为777
⑼ c语言里5%5等于什么
在C里,5%5==0。