repl.it
@EverettErlandso/

E-Add/SubNumbers

C

No description

fork
loading
Files
  • main.c
main.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/*Everett Erlandson and Landyn Moser
File: AreaandPerimeterofaRectangle.c
Purpose: To find the area and perimeter of a rectange*/

#include <stdio.h>

int main(void) {

//Introduction to the user - use printf statements
  printf("\nThis program will tell you the area and perimeter of a rectange based on your input.\n\n");

  //Declare variables - float/double (for decimals) or int (for integers)
  double area;
  double perimeter;
  int original;
  double input;

  //Coder assigns value to variables
original = 0;

// User assigns value to variables - need printf("..."); statement followed by a scanf("%...", &variable); statement 
printf("Input the base of the rectangle\n");
scanf("%lf", &input);
//Manipulations (aka calculations) to determine the value of other variables
area = original * input;
perimeter = original + input + original + input;

//Display results - printf statements with variable placeholders imbedded like %lf (for doubles), %f (float), or %d (int) depending

  return 0;
}
Fetching token
?