Skip to content

Instantly share code, notes, and snippets.

@mmikhan
Created February 14, 2015 15:59
Show Gist options
  • Save mmikhan/417ffa70e75d314f43c7 to your computer and use it in GitHub Desktop.
Save mmikhan/417ffa70e75d314f43c7 to your computer and use it in GitHub Desktop.
Measure the area and perimeter of an rectangle
//
// 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