PDF Google Drive Downloader v1.1


Report a problem

Content text BTAP LTC.docx

BÀI TẬP LẬP TRÌNH C B1, Nhập dãy n số thực ,, tính và in ra -T là tích các số khác không của dãy - M là giá trị nhỏ nhất của dãy -In các giá trị trên cùng 1 dãy Giải : #include<stdio.h> #include<math.h> int main() { int n,i,T=1,M,a[50]; printf("Nhap n:"); scanf("%d",&n); for(i=1;i<=n;i++) { printf("\na%d:",i); scanf("%d",&a[i]);} for(i=1;i<=n;i++) if(a[i]!=0) T=T*a[i]; printf("\nTich cac so khac khong:%d",T); //phan tu nho nhat M=a[1]; for(i=1;i<=n;i++) if(a[i]<a[1]) M=a[i]; printf("\nPhan tu nho nhat cua day:%d",M); //in cac gia tri cua day tren 1 hang
printf("\nCac pt cua day tren cung 1 hang: "); for(i=1;i<=n;i++) printf("%4d ",a[i]); } Bài 2:Nhập 1 dãy n số nguyên, đếm số phần tử chẵn của dãy là S1, tổng các phần tử của dãy là S2 . Tính T=S2/S1 #include"stdio.h" #include"math.h" int main() { int n,i,a[100],S1,S2=0,T; printf("nhap n="); scanf("%d",&n); S1=0; for(i=1;i<=n;i++) { printf("\nnhap a%d=",i); scanf("%d",&a[i]); if (a[i]%2==0) S1++; } printf("\nSo phan tu chan cua day la:%d",S1); //tong cac phan tu cua day for(i=1;i<=n;i++) { S2+=a[i];

Related document

x
Report download errors
Report content



Download file quality is faulty:
Full name:
Email:
Comment
If you encounter an error, problem, .. or have any questions during the download process, please leave a comment below. Thank you.