Monday, August 11, 2014

Câu 1.10: Viết hàm tìm số bé nhất của 3 số thực. Viết chương trình nhập vào từ bàn phím 3 số thực x, y, z, áp dụng hàm trên tìm và in ra màn hình số bé nhất của 3 số vừa nhập.

// bai10.cpp : Defines the entry point for the console application.
//

#include"stdafx.h"
#include<conio.h>
#include<stdio.h>

floatmin(float x, floaty, float z)
{
                floatmin1=x;
                if(min1>y) min1=y;
                elseif (min1>z) min1 = z;
                returnmin1;
}

int_tmain(int argc, _TCHAR* argv[])
{
                floatx,y,z;
                printf("\nNhap 3 so thuc: ");
                scanf("%f%f%f",&x,&y,&z);
                printf("\nmin 3 so %7.3f,%7.3f,%7.3f la %7.3f",x,y,z,min(x,y,z));
                getch();
                return0;

}

No comments:

Post a Comment