本文目錄一覽:
請問數學中 摸球問題什麼情況下用A 什麼情況下用C?
A表示連乘,一般表示每次的情況不一樣就用A。C表示摸球的總的情況,還要從選的情況里除以重複的次數。A是排列的問題和C表示組合的問題,只是情況不一樣而已,A分了順序,而C沒有順序。
你這裡是不是每種顏色的球不一樣?如果是不一樣的,就用A,是一樣的,就用C。
用C語言寫一段代碼
#include stdio.h
#include stdlib.h
void main()
{
int number = 0;
int count = 0;
int sum = 1;
scanf(“輸入總共有幾種顏色的球:%d”, number);
scanf(“輸入要從中選擇的顏色都不一樣的球的個數:%d”, count);
count–;
for (number;number count;number–) {
sum =sum *number;
}
printf(“可能的結果有%d種”, sum);
}
急求c語言編程問題!!!
第一題:題目不是很明確。我覺得答案是0.7
第二題:
#includestdio.h
void main()
{
int red,yellow,green;
for(red=0; red=3; red++)
for(yellow=0; yellow=3; yellow++)
for(green=0; green=6; green++)
{
if(red+yellow+green == 8)
printf(“紅色:%d,黃色:%d,綠色:%d\n”,red,yellow,green);
}
return;
}
第三題:
#includestdio.h
#includemath.h
void main()
{
long one,two,three;
long n;
for(n=100000; n1000000; n++)
{
one = (int)sqrt(n);
two = (int)sqrt(n/1000);
three = (int)sqrt(n%1000);
if((one*one == n) (two*two == (n/1000)) (three*three == (n%1000)))
printf(“%d是一數三平方:\n %d=%d*%d, %d=%d*%d, %d=%d*%d\n”,n,n,one,one,n/1000,two,two,n%1000,three,three);
}
return;
}
原創文章,作者:小藍,如若轉載,請註明出處:https://www.506064.com/zh-hant/n/160941.html