Created
February 14, 2015 15:59
-
-
Save mmikhan/417ffa70e75d314f43c7 to your computer and use it in GitHub Desktop.
Measure the area and perimeter of an rectangle
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 | |
// exercise | |
// | |
// Created by Md Mazedul Islam Khan on 2/14/15. | |
// Copyright (c) 2015 Md Mazedul Islam Khan. All rights reserved. | |
// | |
#include <stdio.h> | |
int main(int argc, const char * argv[]) { | |
int length, width, area, perimeter; | |
printf("Please write the length and width of the rectangle\n"); | |
scanf("%d %d", &length, &width); | |
area = length * width; | |
perimeter = 2 * (length + width); | |
printf("The area of the rectangle is: %d and the perimeter of the rectangle is: %d", area, perimeter); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment