#include<iostream.h>
#include<conio.h>
float smallest (float a, float b , float c);
void main()
{
clrscr();
float n1, n2, n3;
cout<< "Enter three floating point numbers: ";
cin>>n1>>n2>>n3;
cout<<"The smallest floating number is: "<<smallest(n1,n2,n3);
getch();
}
float smallest (float a , float b , float c)
{
if(a<b && a<c)
return a;
else if(b<a && b<c)
return b;
else
return c;
}
#include<conio.h>
float smallest (float a, float b , float c);
void main()
{
clrscr();
float n1, n2, n3;
cout<< "Enter three floating point numbers: ";
cin>>n1>>n2>>n3;
cout<<"The smallest floating number is: "<<smallest(n1,n2,n3);
getch();
}
float smallest (float a , float b , float c)
{
if(a<b && a<c)
return a;
else if(b<a && b<c)
return b;
else
return c;
}
it although gives the correct result but after a single gap it also display 6-7 digits irrelevant digits i dont know why?
ReplyDeletelike it gives the following output:
enter three floating point numbers: 7
2
9
the smallest floating point number is:2 9 6356740
the execution time:0.435s