0% found this document useful (0 votes)
21 views2 pages

Code

The document contains five C programming exercises that demonstrate basic operations such as addition, finding maximum and minimum values, and calculating the average of three integers. Each exercise includes code snippets that utilize standard input and output functions to perform the specified tasks. The programs cover fundamental programming concepts like conditional statements and arithmetic operations.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views2 pages

Code

The document contains five C programming exercises that demonstrate basic operations such as addition, finding maximum and minimum values, and calculating the average of three integers. Each exercise includes code snippets that utilize standard input and output functions to perform the specified tasks. The programs cover fundamental programming concepts like conditional statements and arithmetic operations.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Bài 1

#include<stdio.h>
int main()
{
float a,b,tong;
scanf("%f", &a);
scanf("%f", &b);
tong=a+b;
printf("%f", tong);
return 0;
}

Bài 2

#include<stdio.h>
int main()
{
float a,b, max;
scanf("%f", &a);
scanf("%f", &b);
max=a;
if (max<b)
max=b;
printf("%6.2f", max);
return 0;
}

Bài 3

#include<stdio.h>
int main()
{
float x,y, min;
scanf("%f", &x);
scanf("%f", &y);
if (x<y)
min = x;
else
min = y;
printf("%f", min);
return 0;
}
Bài 4

#include<stdio.h>
int main()
{
float x,y, max;
scanf("%f", &x);
scanf("%f", &y);
if (x>y)
max = x;
else
max = y;
printf("%f", max);
return 0;
}

Bài 5

#include <stdio.h>

int main()
{
int a,b,c;
float tong;

printf("Nhap a: ");
scanf("%d", &a);

printf("Nhap b: ");
scanf("%d", &b);

printf("Nhap c: ");
scanf("%d", &c);

tong= a + b + c;

printf("Tong 3 so a,b,c : %f\n", tong);


printf("Trung binh cong 3 so : %f\n", tong/3);
return 0;
}

You might also like