Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void main()
- {
- int a,b,c,d;
- scanf("%d%d%d",&a,&b,&c);
- d=b*b-4*a*c;
- if(d>0)
- {
- double x=(-1*b-sqrt(d))/(2*a),y=(-1*b+sqrt(d))/(2*a);
- int k=(int)x,l=(int)y;
- if(x<y){
- if(k-x==0)printf("%d ",k);
- else printf("%.1f ",x);
- if(l-y==0)printf("%d",l);
- else printf("%.1f",y);}
- else
- {
- if(l-y==0)printf("%d ",l);
- else printf("%.1f ",y);
- if(k-x==0)printf("%d",k);
- else printf("%.1f",x);
- }
- }
- if(d<0)printf("No real solutions");
- if(d==0)
- { double x=(-1*b)/(2*a);int z=(int)x;if(x-z==0)printf("%d",z);else printf("%.1f",x);}}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement