Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Tinh gia tri nho nhat cua mang so thuc
- // Khai bao cac ham thu vien neu co
- #include<stdio.h>
- #include<conio.h>
- #define SIZE 100
- void nhap(float a[],int &n)
- {
- scanf("%d",&n);
- float x;
- for(int i=0;i<n;i++)
- {
- scanf("%f",&x);
- a[i]=x;
- }
- }
- float nhonhat(float a[],int n)
- {
- float min=a[0];
- for(int i=0;i<n;i++)
- {
- if(a[i]<min)
- min=a[i];
- }
- return min;
- }
- void main()
- {
- float a[SIZE];
- int n;
- nhap(a,n);
- printf("%.2f",nhonhat(a,n));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement