0% found this document useful (0 votes)
9 views7 pages

BTTH Code Ho Dang Quang.

The document is a C program that performs several tasks including summing numbers divisible by 3 or 5, calculating the factorial of a number, determining the type of triangle based on three sides, printing multiplication tables, and calculating the power of a number. It prompts the user for input for each task and displays the results accordingly. The program also includes conditional checks for triangle validity and types.

Uploaded by

Ho Quang
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views7 pages

BTTH Code Ho Dang Quang.

The document is a C program that performs several tasks including summing numbers divisible by 3 or 5, calculating the factorial of a number, determining the type of triangle based on three sides, printing multiplication tables, and calculating the power of a number. It prompts the user for input for each task and displays the results accordingly. The program also includes conditional checks for triangle validity and types.

Uploaded by

Ho Quang
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

#include <stdio.

h>

int main(){
int n, a[100], tong=0;
printf("Nhap vao n: ");
scanf("%d", &n);

for (int i=0; i<n; i++){


printf("Nhap vao a[%d]: ", i);
scanf("%d", &a[i]);
if((a[i]%3==0) || (a[i]%5==0)){
tong= tong + a[i];
}
}
printf("Tong cac so chia het cho 5 va 3 la: %d", tong);

int giaithua=1, n2;


printf("\nNhap so de tinh giai thua: ");
scanf("%d", &n2);
for (int j=1; j<=n2; j++){
giaithua= giaithua * j;
}
printf("\nGiai thua la: %d", giaithua);
int z, b, c;
printf("\nNhap canh a: ");
scanf("%d", &z);
printf("Nhap canh b: ");
scanf("%d", &b);
printf("Nhap canh c: ");
scanf("%d", &c);
if((z+b>c)&&(b+c>z)&&(z+c>b)){
if(z*z==b*b+c*c||b*b==c*c+z*z||c*c==b*b+z*z)
printf("3 canh vua nhap tao thanh tam giac vuong\n");
else if(z==b||z==c||c==b)
printf("3 canh vua nhap tao thanh tam giac can\n");
else if(z==b==c)
printf("3 canh vua nhap tao thanh tam giac deu\n");
else
printf("3 canh vua nhap tao thanh tam giac thuong\n");
}
else{
printf("3 canh vua nhap khong tao thanh tam giac\n");
}

for(int i=2;i<=9;i++){
printf("Nhap bang cuu chuong %d\n",i);
for(int j=1;j<=10;j++){
printf("%d x %d = %d\n",i,j,i*j);
}
}
int m,k,y=1;
printf("\nNhap a: ");
scanf("%d", &m);
printf("Nhap b: ");
scanf("%d", &k);
if(k<0){
int t=-k;
for(int i=1;i<=t;i++){
y=y*m;
}
}
else{
int t=k;
for(int i=1;i<=t;i++){
y=y*m;
}
}
if(k<0)
printf("Gia tri cua a^b la:1/%d",y);
else
printf("Gia tri cua a^b la: %d",y);
}
1.D 2.B 3.C
4.D

5.A
6.D

7.D

8.A

9.C
10.B

You might also like