This document contains 8 programming code examples in Vietnamese with the following purposes:
1) A program to calculate the area of a shape (example 1)
2) A program to swap the values of two variables (example 2)
3) A program to compare two integer values (example 3)
4) A program to check the solution(s) of a linear equation (example 4)
5) A program to calculate a discount on an amount of money (example 5)
6) A program to check if a number is even or odd (example 6)
7) A program to print two integer values in descending or ascending order (example 7)
8) A program to check if a
This document contains 8 programming code examples in Vietnamese with the following purposes:
1) A program to calculate the area of a shape (example 1)
2) A program to swap the values of two variables (example 2)
3) A program to compare two integer values (example 3)
4) A program to check the solution(s) of a linear equation (example 4)
5) A program to calculate a discount on an amount of money (example 5)
6) A program to check if a number is even or odd (example 6)
7) A program to print two integer values in descending or ascending order (example 7)
8) A program to check if a
This document contains 8 programming code examples in Vietnamese with the following purposes:
1) A program to calculate the area of a shape (example 1)
2) A program to swap the values of two variables (example 2)
3) A program to compare two integer values (example 3)
4) A program to check the solution(s) of a linear equation (example 4)
5) A program to calculate a discount on an amount of money (example 5)
6) A program to check if a number is even or odd (example 6)
7) A program to print two integer values in descending or ascending order (example 7)
8) A program to check if a
uses crt; uses crt; var a, b, s1, s2, s : real; var tien:real; const pi = 3.14; begin begin clrscr; clrscr; write('Nhap so tien:'); readln(tien); write('nhap do dai a :');readln(a); if tien>=100000 then tien:=80*tien/100 write('nhap do dai b :');readln(b); else tien:=tien*90/100 s1 := 2 * a * b; readln; s2 := (a * a * pi)/2; end. s := s1 + s2; writeln('dien tich hinh A la :', s:3:2); readln Câu 6: end. Program Chan_le; Câu 2. uses crt; program hoan_doi; var a: integer; uses crt; begin var x,y,z:real; clrscr; begin write('nhap vao so a ='); readln(a); Write('nhap x='); if ( a mod 2 = 0 ) then write(' a la so chan ') Readln(x); else write('a la so le '); Write (' nhap y ='); readln; Readln(y); end. z:=x; x:=y; y:=z; Câu 7: Write ('gia tri x la: ',x); Program bai7; Write ('gia tri y la : ',y); uses crt; Readln; var a,b:longint; end. begin Câu 3: clrscr; Program bai3; write('Nhap a,b: '); readln(a,b); uses crt; if a>b then write(b,' ',a) else write(a,' ',b); var a,b:integer; readln; begin end. clrscr; write('nhap a:');readln(a); write('nhap b:');readln(b); Câu 8 if a>b then write('a>b') Program bai8; else if a<b then write('a<b') uses crt; else write('a=b'); var a:integer; readln; begin end. clrscr; Câu 4: write('Nhap a='); readln(a); program giaipb1; if a<0 then writeln(a,' la so am') uses crt; else if a>0 then writeln(a,' la so duong') var b,c:real; else writeln(a,' khong la so am cung khong la so duong'); begin readln; clrscr; end. writeln('nhap so b:’);readln(b); writeln(‘nhap so c:’);readln(c); If (b =0) and (c<>0) then writeln('Phuong trinh vo nghiem'); If (b=0) and (c=0) then writeln('Phuong trinh co vo so nghiem'); If (b<>0) and(c<>0) then writeln('Phuong trinh co nghiem x=',-c/b; readln; end.