Professional Documents
Culture Documents
"Stdio.h" "Conio.h": #Include #Include Void Int Float
"Stdio.h" "Conio.h": #Include #Include Void Int Float
"Stdio.h" "Conio.h": #Include #Include Void Int Float
#include "stdio.h"
#include "conio.h"
void main()
{
int i,n;
float a[10]; // khai bao mang gom 10 phan tu
clrscr();
printf("\n Chuong trinh vao-ra mang bai 5-1");
// Nhap so luong phan tu - Su dung do while khi muon kiem soat n<10
do
{
printf("\n Nhap so luong phan tu n = ");
scanf("%d", &n);
}
while (n<0 || n >= 10);
////Co the gop toan bo cau b vao 1 vong lap nhu sau
//float fTBC = 0.0;
//int dem = 0;
//int fTongDuong = 0;
//int count = 0;
//
//for (int i = 0; i < n; i++)
//{
// if (a[i] < 0)
// {
// fTBC += a[i];
// dem++;
// }
if (bCoSoX == 0)
printf("Khong co so %8.2f trong day da nhap", x);
getch();
return;
}
Bài 2:
#include "stdio.h"
#include "conio.h"
#include "math.h"
void main()
{
int i,j,n;
float a[10]; // khai bao mang gom 10 phan tu
clrscr();
printf("\n Chuong trinh sap xep mang bai 5-2");
// Nhap so luong phan tu - Su dung do while khi muon kiem soat n<=10
do
{
printf("\n Nhap so luong phan tu n = ");
scanf("%d", &n);
}
while (n<0 || n > 10);
getch();
return;
}
Bài 3:
#include "stdio.h"
#include "conio.h"
void main()
{
int i,j;
float a[2][2]; // khai bao mang 2x2
float c[2]; // khai bao mang gom 2 phan tu
clrscr();
printf("\n Chuong trinh Giai He PT 5-2");
//Nhap cac he so
for (i = 0; i < 2; i++)
for (j = 0; j < 2; j++)
{
printf("\n a[%d, %d] = ", i + 1, j + 1);
scanf("%f", &a[i][j]);
}
if (D == 0)
if (Dx == 0 && Dy == 0)
printf("\n He PT co vo so nghiem");
else //else luon di cap voi if gan nhat ---> d == 0 va hoac dx != 0 hoac dy != 0
printf("\n He PT co vo nghiem");
else
{
printf("\n Nghiem duy nhat cua he la:");
printf("\n x = %8.2f", Dx / D);
printf("\n y = %8.2f", Dy / D);
}
getch();
return;
}
Bài 4:
#include "stdio.h"
#include "conio.h"
void main()
{
int i, n;
float a[10];
float b[10];
float c[10];
clrscr();
printf("\n Chuong trinh sao chep mang");
getch();
return;
}
Bài 5:
#include "stdio.h"
#include "conio.h"
#include "string.h"
void main()
{
char s[30];
clrscr();
printf("\n Nhap ten sinh vien: ");
gets(s);
getch();
return;
}
Bài 6:
#include "stdio.h"
#include "conio.h"
#include "string.h"
void main()
{
int i, j, n;
char danhsach[10][30];
clrscr();
getch();
return;
}
Bài 7:
#
#include "stdio.h"
#include "conio.h"
#include "string.h"
void main()
{
char s1[30];
char s2[30];
clrscr();
printf("\n\n Thuc hien strcat(s1, s2) de noi xau s2 vao sau xau s1");
strcat(s1, s2);
printf("\n Xau s1 la: %s", s1);
printf("\n Xau s2 la: %s", s2);
printf("\n\n Thuc hien strcpy(s1, s2) de copy xau s2 vao xau s1 \n");
strcpy(s1, s2);
printf("\n Xau s1 la: %s", s1);
printf("\n Xau s2 la: %s", s2);
getch();
return;
}