修改以后的代码:
int main()
{int i
float A[4],B[3],C[2],D,
x[5]={0.4,0.55,0.65,0.8,0.9},y[5]={0.41075,0.57815,0.69675,0.88811,1.02652}
for(i=0i<5i++)
A[i]=(y[i+1]-y[i])/(x[i+1]-x[i])
for(i=0i<4i++)
printf("A[%d]=%f\t",i,A[i])
for(i=0i<4i++)
B[i]=(A[i+1]-A[i])/(x[i+2]-x[i])
for(i=0i<3i++)
printf("B[%d]=%f\t",i,B[i])
for(i=0i<3i++)
C[i]=(B[i+1]-B[i])/(x[i+3]-x[i])
for(i=0i<2i++)
printf("C[%d]=%f\t",i,C[i])
D=(C[i+1]-C[i])/(x[4]-x[0])
printf("D=%f\t",D)
return 0
}
修改以后的结论:
A[0]=1.116000 A[1]=1.186001 A[2]=1.275733 A[3]=1.384101 B[0]=0.280003 B[1]=0.358930 B[2]=0.433471 C[0]=0.197316 C[1]=0.212976 D=-0.397131
#include "stdio.h"
main()
{ int a,b
printf("请输入两个整数(a,b):")
scanf("%d,%d"改困,&a,&b) 塌携 团歼伏
printf("和:%d\n",a+b)
printf("差:%d\n",a-b)
printf("积:%d\n",a*b)
printf("商:%f\n",(float)a/b)}
代棚激码一:
#include <stdio.h>
int main(void)
{
int num1, num2
scanf("%d%d",&num1,&num2)
printf("%d + %d = %d\n"链顷袜,num1,num2,num1+num2)
printf("%d - %d = %d\n", num1, num2, num1-num2)
printf("%d * %d = %d\n", num1, num2, num1*num2)
if (num2) printf("%d / %d = %g\n", num1, num2, (double)num1/num2)
else printf("ERROR ,DIV BY ZERO\n")
printf("%d %% %d = %d\n", num1, num2, num1%num2)
return 0
}
代码二:
#include <stdio.h>
void main()
{
int x, y
printf("please enter a,b,c:")
scanf("%d,%d",&x,&y)
printf("\nx+y=%d\n",x+y)
printf("x-y=%d\n",x-y)
printf("x*y=%d\n",x*y)
printf("x/y=%d\n",x/y)
printf("x%%y=%d\n",x%y)
}
扩展资料:算术运算符实例:
#include <stdio.h>
main()
{
int a = 21
int b = 10
int c
c = a + b
printf("Line 1 - c 的值是 %d\n", c )
c = a - b
printf("Line 2 - c 的值是 %d\n", c )
c = a * b
printf("Line 3 - c 的值是 %d\n", c )
c = a / b
printf("Line 4 - c 的值是 %d\n", c )
c = a % b
printf("乎蠢Line 5 - c 的值是 %d\n", c )
c = a++
printf("Line 6 - c 的值是 %d\n", c )
c = a--
printf("Line 7 - c 的值是 %d\n", c )
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)