Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <math.h>
- void getData (double*,double*);
- void printRes(double,double);
- void printSer(double,double);
- void AreaPerimeter(double,double);
- int main (void){
- double a = 0, b = 0;
- getData (&a, &b);
- printRes(a, b);
- printSer(b, a);
- AreaPerimeter(a, b);
- }
- void getData (double *a, double *b){
- printf("Please enter two integer numbers: ");
- scanf("%lf %lf", a, b);
- }
- void printRes (double a, double b){
- printf("%lf %lf\n", a, b);
- }
- void printSer (double b, double a){
- printf("%lf %lf\n", b, a);
- }
- void AreaPerimeter (int a, int b){
- double hypotenuse = sqrt(pow(a,2) + pow(b,2));
- printf("The perimeter of a right triangle with a base of %d, a height of %d and a hypotenuse of %lf is %lf.\n\n"
- "The area of a right triangle with base %d and height %d is %.2lf.\n", a, b, hypotenuse, (double)(a + b) + hypotenuse, a, b, (double)(a * b)/2);
- }
Advertisement
Add Comment
Please, Sign In to add comment