Last active
May 1, 2018 02:32
-
-
Save hocarm/c34f6ea6e0daab0073fc5fb834e43484 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Tính diện tích căn phòng hình vuông | |
// Input: Kích thước căn phòng (kiểu unsigned long) đơn vị mét | |
// Output: Diện tích căn phòng (kiểu unsigned long) đơn vị mét vuông | |
unsigned long Calc_Area(unsigned long s) { | |
unsigned long result; | |
result = s*s; | |
return(result); | |
} | |
int main(void) { | |
unsigned long side; // Kích thước căn phòng | |
unsigned long area; // Diện tích căn phòng | |
UART_Init(); // gọi subroutine để init uart | |
printf("This program calculates areas of square-shaped rooms\n"); | |
side = 3; | |
area = Calc_Area(side); | |
printf("\nArea of the room with side of %ld m is %ld sqr m\n",side,area); | |
side = side+2; | |
area = Calc_Area(side); | |
printf("\nArea of the room with side of %ld m is %ld sqr m\n",side,area); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment