Created
March 20, 2015 21:12
-
-
Save mmikhan/32754bd83a0aba3ab84c to your computer and use it in GitHub Desktop.
Write a small C program to calculate and display the area of a rectangle using the formula mentioned in the example
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
| // | |
| // main.c | |
| // midterm | |
| // | |
| // Created by Md Mazedul Islam Khan on 3/21/15. | |
| // Copyright (c) 2015 Md Mazedul Islam Khan. All rights reserved. | |
| // | |
| #include <stdio.h> | |
| #include <math.h> | |
| int main(int argc, const char * argv[]) { | |
| int area, length, width; | |
| printf("Please enter the length of the reactangle: "); | |
| scanf("%d", &length); | |
| printf("Please enter the width of the reactangle: "); | |
| scanf("%d", &width); | |
| area = length * width; | |
| printf("Length of the reactangle is: %d\n", length); | |
| printf("Width of the rectangle is: %d\n", width); | |
| printf("The area of the rectangle is: %d\n", area); | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment