利用VI编写C程序
答案:1 悬赏:30
解决时间 2021-02-10 13:13
- 提问者网友:夕夏残阳落幕
- 2021-02-09 16:30
利用VI编写C程序
最佳答案
- 二级知识专家网友:无字情书
- 2021-02-09 17:57
1)
#include<stdio.h>
void main()
{
int i,j;
scanf("%d,%d",&i,&j);
printf("%d",i>j?i:j);
}
2)
#include <math.h>
#include <stdio.h>
main( )
{
float a,b,c,s,x1,x2;
double t;
printf(" please input a,b,c:");
scanf("%f %f %f" , &a , &b , &c);
if (a==0.0)
if(b != 0.0)
printf("the root is :%f\n",-c/b);
else if (c==0.0)
printf("x is inexactive\n ");
else
printf("no root!\n");
else
{
s = b * b - 4 * a * c ;
if(s > = 0.0)
if(s > 0.0)
{
t = sqrt( s ) ;
x1 = -0.5 *(b + t) / a;
x 2 = - 0.5 * ( b - t ) / a ;
printf("There are two different roots:%f and%f\n" ,x 1 , x 2 ) ;
}
else
printf("There are two equal roots:%f\n",-0.5*b/a);
else
{
t = sqrt( -s );
x1=-0.5*b/a; / *实部* /
x2=abs(0.5*t/a); /*虚部的绝对值* /
printf("There are two virtual roots:");
printf("%f+i%f\t\t%f-i%f\n",x1,x2,x1,x2 );
}
}
}
#include<stdio.h>
void main()
{
int i,j;
scanf("%d,%d",&i,&j);
printf("%d",i>j?i:j);
}
2)
#include <math.h>
#include <stdio.h>
main( )
{
float a,b,c,s,x1,x2;
double t;
printf(" please input a,b,c:");
scanf("%f %f %f" , &a , &b , &c);
if (a==0.0)
if(b != 0.0)
printf("the root is :%f\n",-c/b);
else if (c==0.0)
printf("x is inexactive\n ");
else
printf("no root!\n");
else
{
s = b * b - 4 * a * c ;
if(s > = 0.0)
if(s > 0.0)
{
t = sqrt( s ) ;
x1 = -0.5 *(b + t) / a;
x 2 = - 0.5 * ( b - t ) / a ;
printf("There are two different roots:%f and%f\n" ,x 1 , x 2 ) ;
}
else
printf("There are two equal roots:%f\n",-0.5*b/a);
else
{
t = sqrt( -s );
x1=-0.5*b/a; / *实部* /
x2=abs(0.5*t/a); /*虚部的绝对值* /
printf("There are two virtual roots:");
printf("%f+i%f\t\t%f-i%f\n",x1,x2,x1,x2 );
}
}
}
我要举报
如以上问答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯