Bài TH C Hành 2
Bài TH C Hành 2
Bài TH C Hành 2
MSSV: 23134011
bài 1:
#include <stdio.h>
#include <stdlib.h>
int main()
int i, j;
int c= 0, a, b= 0, x;
while(b!= 1){
if(a== 1){
if(j== 2)printf("\n");
}
if(a== 2){
while(c!= 1){
if(arr[j][i]== x){
c=1;
if(c != 1){
if(a== 3)break;
return 0;
bài 2:
#include <stdio.h>
int main(){
int M[10];
int i,c;
float a,d;
printf("nhap du lieu:");
scanf("%d", &M[i]);
printf("%d\t", M[i]);
d=d+M[i];
printf("\n");
printf("%d\t",M[i]);
printf("\n");
if (M[i]>M[i+1]){
c=M[i+1];
M[i+1]=M[i];
M[i]=c;
a=d/10;
printf("%0.2f",a );
return 0;
bài 3:
#include <stdio.h>
#include <stdlib.h>
int main(){
int n;
printf("nhap");scanf("%d", &n);
float m[n];
float a[n];
int i;
m[i]=rand()% 150;
a[0]=(m[0] + m[1])/2;
a[n-1]=(m[n-2]+ m[n-1])/2;
printf("%f\t",a[i]);
return 0;
}
bai 4:
#include <stdio.h>
#include<stdlib.h>
struct pro{
int sp;
int soluong;
};
int main()
int n;
int i;
int b= 0, a, c, d, e= 0;
while(b!= 1){
if(a== 1){
if(c== arr[i].sp){
arr[i].soluong+=d;
e++;
if(e== 0){
n++;
arr[n- 1].sp= c;
arr[n- 1].soluong= d;
if(a== 2){
arr[i].soluong-=d;
printf("khong du so luong\n");
if (a== 3){
}
if(a== 4){
break;
return 0;