1. 急求! 用c語言解決高等數學問題
#include<攔賀stdio.h>
#include<stdlib.h>
int main()
{
int n = 6;
double aaverage=0,paverage=0,psquare=0,pmultiplya=0;
double a[]={181,197,235,270,283,292};
double p[]={36.9,46.7,63.7,77.8,84,87.5};
for(int i=0;i<賣源n;i++)
{
aaverage+=a[i];
paverage+=p[i];
psquare+=p[i]*p[i];
pmultiplya+=a[i]*p[i];
}
aaverage/=n;
paverage/=n;
double aa = (pmultiplya-n*aaverage*paverage)/中衡態(psquare-n*paverage*paverage);
double b = aaverage-aa*paverage;
printf("a=%lf,b=%lf",aa,b);
}
2. 數學問題用C語言編程解決已知一段曲線的坐標數據,X依次為0,3,5,7,9,11,12,13,14
#include
#define N 16
main()
{
int i;
int j;
char ch;
int number=0;
int a[5][N]={{1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31},{2,3,6,7,10,11,14,15,18,19,22,23,26,27,30,31 },{4,5,6,7,12,13,14,15,20,21,22,23,28,29,30,31 },{8,9,10,11,12,13,14,15,24,25,26,27,28,29,30,31},{16,17,18,19,20,21,22,23,24,25,26,27,28,29,30
,31}};
for(i=0;i
3. 用C語言解決一個數學問題
答案就是組合數C(n)4
你想多了,而且效率太低,有很多條件沒用上
i<k<j<鏈清磨p
循環限制條件i<n-2,i<k<n-1,k<j<n,j<p<=n,條件都滿足時x++
沒有重復算
直接正好得出結棚斗果x
4. 用C語言解決鬼谷算題
if(x%3==2&&x%5==3&&x%7==2);
把這句後面的;去掉就行了
5. 求用C語言編程,解決如下數學問題:在線求答案!:很是感謝了!
#include<stdio.h>
void main()
{
int a12,b8,c5;
a12=12;
c5=b8=0;
printf("a12b8c5\n");
printf("%-3d%-3d%-3d\n",a12,b8,c5);
printf("%-3d%-3d%-3d\n",a12-=8,b8+=8,c5);
printf("%-3d%-3d%-3d\n",a12,b8-=5,c5+=5);
printf("%-3d%-3d%-3d\n",a12+=5,b8,c5-=5);
printf("%-3d%-3d%-3d\n",a12,b8-=3,c5+=3);
printf("%-3d%-3d%-3d\n",a12-=8,b8+=8,c5);
printf("%-3d%-3d%-3d\n",a12,b8-=2,c5+=2);
printf("%-3d%-3d%-3d\n",a12+=5,b8,c5-=5);
}
6. C語言利用遞歸函數解決一個數學問題
#include <stdio.h>
int test(int total, int count)
{
if(count == 6) //如果分五次之後仍滿宴念足要求,則該數為所求
{
return 1;
}
if(total % 5 != 1) //如果不滿足分顫祥橘五分後剩一個則該數不滿足要求
return 0;
else if( test((total-1) * 4 / 5, count+1)) //將該茄團數的5分之1繼續嘗試分
{
printf("第%d次分時還剩%d個桃子\n", count, total);
return 1;
}
else return 0;
}
int main()
{
int i = 4;
while(1)
{
if(test(++i, 1)) break; //看看此數是否能夠符合題意
}
printf("the num is %d\n", i);
return 1;
}
//其實這題用遞歸不好
7. 用C語言解決數學問題
顯然需要9天,程序如下:
#include <stdio.h>
int main()
{
int i=0;
double s=0.0;
while(1)
{
s+=1.5;
if(s>=10) break;
else s -=0.5;
i++;
}
printf("%dday\n",i);
return 0;
}
8. 百雞問題怎麼用C語言求解
用C語言解決百雞問題的步驟如下:
1丶打開網頁C語言編譯環境,或者自己的安裝的編譯環境。
這樣就解決了用C語言解決百雞問題。