⑴ 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。