Last active
May 1, 2018 02:03
-
-
Save hocarm/c686ed1218f4239b37acb6a387d1d7a0 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| unsigned long Calc_Area(unsigned long s); | |
| int main(void) { | |
| unsigned long side; // độ dài bức tường đơn vị met | |
| unsigned long area; // diện tích căn phòng đơn vị met vuô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); | |
| } | |
| // Tính diện tích căn phòng | |
| // Input: độ dài 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); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment