c语言编程题及答案,c语言笔试题及答案

1,c语言笔试题及答案我就把主程序写给你啊main()int x;long int f;printf("Please input x: ");if(x>0)f=2x-1;else if(x=0)f=-7909;elsef=-5x+27;printf("F(x)=%ld",f);}还有你说的图一 根本看不到、、
2,c语言编程题答案#include <stdio.h>int Fib (int n);//函数声明void main (){ int i,n; printf ("input the n: "); scanf ("%d",&n); printf ("斐波契数列的前%d项为:\n",n);//输入项数 for (i=0;i<=n;i++) printf ("%d ",Fib (i)); printf ("\n");}int Fib (int n){ if (n==0||n==1) return 1; return Fib(n-2)+Fib(n-1);}
3,C语言编程题 求答案#include <stdio.h>int main(void) int number[8],num[3][3],i,j,k = 0,temp; printf("请将1~8打乱输入\n"); for(i = 0;i < 8;i++) scanf("%d",&number[i]); }printf("你输入的:\n"); for(i = 0;i < 3;i++)for(j = 0;j < 3;j++)if(i == 1 && j == 1)printf("");continue;}elseprintf("%d",number[k++]);}printf("\n"); }for(i = 0;i < 7;i++)for(j = 0;j < 7 - i;j++)if(number[j] > number[j + 1])temp = number[j];number[j] = number[j + 1];number[j + 1] = temp;}} }k = 0; for(i = 0;i < 3;i++)for(j = 0;j < 3;j++)if(i == 0)num[i][j] = number[k++];}else if(i == 1)if(j == 0)num[i][j] = number[7];else if(j == 1)continue;elsenum[i][j] = number[k];k += 3;}}elsenum[i][j] = number[k--];} } printf("运行后的:\n"); for(i = 0;i < 3;i++)for(j = 0;j < 3;j++)if(i == 1 && j == 1)printf("");elseprintf("%d",num[i][j]);}printf("\n"); } return 0;}【c语言编程题及答案,c语言笔试题及答案】
4,c语言编程题目及答案#include #include void main(void) { double a; double b; double c;/* 以上三个变量分别对应三边 */ double sin_c;/* c边对应角的正玄值 */ double cos_c;/*c边对应角的余玄值*/ double cos_a; double area; /* 三角形的面积 */ printf("输入a , b , c:"); scanf("%lf, %lf, %lf", &a, &b, &c); if(((a+b)>c) && (a-b) { printf("三边能够成三角形\n."); cos_c = (a*a + b*b -c*c)/(2*a*b); cos_a = (b*b + c*c - a*a)/(2*b*c); if ((cos_c > 0) && (cos_a >0)) { printf("三角形是锐角三角形 。\n"); } else if ((cos_c < 0) || (cos_a < 0)) { printf("三角形是钝角三角形\n"); } else { printf("三角形是直角三角形\n"); } sin_c = sqrt(1- cos_c*cos_c); area = a*b*sin_c/2; printf("三角形的面积是%f.\n",area); } else { printf("三边不能构成三角形\n"); } }#include &lt;stdio.h&gt;#include &lt;math.h&gt;void main(void) double a; double b; double c;/* 以上三个变量分别对应三边 */ double sin_c;/* c边对应角的正玄值 */ double cos_c;/*c边对应角的余玄值*/ double cos_a; double area; /* 三角形的面积 */ printf("输入a,b , c:"); scanf("%lf, %lf, %lf", &amp;a, &amp;b, &amp;c); if(((a+b)&gt;c) &amp;&amp; (a-b)&lt;c)printf("三边能够成三角形\n."); cos_c = (a*a + b*b -c*c)/(2*a*b); cos_a = (b*b + c*c - a*a)/(2*b*c); if ((cos_c &gt; 0) &amp;&amp; (cos_a &gt;0))printf("三角形是锐角三角形 。\n"); } else if ((cos_c &lt; 0) || (cos_a &lt; 0))printf("三角形是钝角三角形\n"); } elseprintf("三角形是直角三角形\n"); } sin_c = sqrt(1- cos_c*cos_c); area = a*b*sin_c/2; printf("三角形的面积是%f.\n",area); } elseprintf("三边不能构成三角形\n"); }}

    推荐阅读