[ create a new paste ] login | about

Link: http://codepad.org/ojVznYpl    [ raw code | output | fork ]

C, pasted on Aug 13:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <stdio.h>
int main (void)
{
  float length,width;

printf("Enter the length of the rectangle;\n");
while (scanf("%f", &length)==1)
{
      printf("Length = %0.2f;\n",length);
      printf("enter its width;\n");
      if (scanf("%f",&width)!= 1)
          break;
      printf("Width = %0.2f;\n",width);
      printf("Area = %0.2f;\n",length * width);
      printf("Enter the length of the rectangle;\n");
    }
      printf("done.\n");
      return 0;
}


Output:
1
2
Enter the length of the rectangle;
done.


Create a new paste based on this one


Comments: