viernes, 16 de noviembre de 2018


PROGRAMA GEOMETRICO PARA HALLAR AREAS Y PERIMETROS
#include <conio.h>
#include <stdio.h>
#include <math.h>

#define PI 3.141516

int main ()
{
                int a1,a,l,m,n,b,b1,h,d1,d,B,o,s,s1,op;
                float area, r, per;
               
                printf("\n AREAS Y PERIMETROS");
                printf("\n 1- CIRCULO");
                printf("\n 2- RECTANGULO");
                printf("\n 3- TRIANGULO");
                printf("\n 4- CUADRADO");
                printf("\n 5- PENTAGONO");
                printf("\n 6- ROMBO");
                printf("\n 7- ROMBOIDE");
                printf("\n 8- TRAPECIO");
                printf("\n 9- HEXAGONO");
                printf("\n 10- ECLIPSE");
                printf("\n 11- POLIGONO IRREGULAR");
                printf("\n Ingrese su opcion:");
                scanf("%d", & op);
               
                if (op==1)
                {
               
                               printf ("\n CIRCULO:");
                               printf ("\n Introduzca Diametro:");
                               scanf ("%d", &d);
                               printf ("\n Introduzca Radio:") ;
                               scanf ("%f", &r);
               
                               per = d * PI;
                               printf ("\n EL PERIMETRO DEL CIRCULO ES: %.2f", per) ;
               
                               area = PI * pow(r, 2);
                               printf ("\n EL AREA DEL CIRCULO  ES: %.2f", area) ;
                }
               
                               if (op==2)
                {
               
                               printf ("\n RECTANGULO:");
                               printf ("\n Introduzca base:");
                               scanf ("%d", &b);
                               printf ("\n Introduzca Altura:");
                               scanf ("%d", &h);
               
                               per = b*h;
                               printf ("\n EL PERIMETRO DEL RECTANGULO ES: %.2f", per) ;
                              
                               area = pow(b,2) + pow(h,2);
                               printf ("\n EL AREA DEL RECTANGULO  ES: %.2f", area) ;
                }
               
                if (op==3)
                {
               
                               printf ("\n TRIANGULO:");
                               printf ("\n INGRESE LADO 1:");
                               scanf ("%d", &l);
                               printf ("\n INGRESE LADO 2:");
                               scanf ("%d", &m);
                               printf ("\n INGRESE LADO 3:");
                               scanf ("%d", &n);
                              
                               printf ("\n Introduzca base:");
                               scanf ("%d",&b);
                               printf ("\n Introduzca Altura:");
                               scanf ("%d",&h);
                              
                               per = l+m+n;
                               printf ("\n EL PERIMETRO DEL TRIANGULO ES: %.2f", per) ;
                              
                               area = b*h/2;
                               printf ("\n EL AREA DEL TRIANGULO ES: %.2f", area) ;
                }
                               if (op==4)
                {
               
                               printf ("\n CUADRADO:");
                               printf ("\n INGRESE LADO:");
                               scanf ("%d", &a);
                              
                               per = pow(a,2);
                               printf ("\n EL PERIMETRO DEL CUADRADO ES: %.2f", per) ;
                              
                               area = pow(a,4);
                               printf ("\n EL AREA DEL CUADRADO  ES: %.2f", area) ;
                }
               
                               if (op==5)
                {
               
                               printf ("\n PENTAGONO:");
                               printf ("\n Introduzca base:");
                               scanf ("%d", &b);
                               printf ("\n Introduzca apotema:");
                               scanf ("%d", &a1);
                              
                              
                               per = pow(b,5);
                               printf ("\n EL PERIMETRO DEL PENTAGONO ES: %.2f", per) ;
                              
                               area = per*a1/2;
                               printf ("\n EL AREA DEL PENTAGONO  ES: %.2f", area) ;
                }
               
                if (op==6)
                {
               
                               printf ("\n Rombo:");
                               printf ("\n Introduzca lado:");
                               scanf ("%d", &a);
                               printf ("\n Introduzca diagonal menor:");
                               scanf ("%d", &d);
                               printf ("\n Introduzca diagonal mayor:");
                               scanf ("%d", &d1);
                              
                               per = pow(a,4);
                               printf ("\n EL PERIMETRO DEL ROMBO ES: %.2f", per) ;
                              
                               area = d1*d/2;
                               printf ("\n EL AREA DEL ROMBO ES: %.2f", area) ;
                }
               
                               if (op==7)
                {
               
                               printf ("\n ROMBOIDE:");
                               printf ("\n Introduzca base:");
                               scanf ("%d", &b);
                               printf ("\n Introduzca Altura:");
                               scanf ("%d", &h);
               
                               per = b*h;
                               printf ("\n EL PERIMETRO DEL ROMBOIDE ES: %.2f", per) ;
                              
                               area = pow(b,2) + pow(h,2);
                               printf ("\n EL AREA DEL ROMBOIDE  ES: %.2f", area) ;
                }
                if (op==8)
                {
               
                               printf ("\n TRAPECIO");
                               printf ("\n Introduzca lado 1:");
                               scanf ("%d", &l);
                               printf ("\n Introduzca lado 2:");
                               scanf ("%d", &m);
                               printf ("\n Introduzca lado 3:");
                               scanf ("%d", &n);
                               printf ("\n Introduzca lado 4:");
                               scanf ("%d", &o);
                               printf ("\n Introduzca base  menor:");
                               scanf ("%d", &b);
                               printf ("\n Introduzca base mayor:");
                               scanf ("%d", &b1);
                               printf ("\n Introduzca altura:");
                               scanf ("%d", &h);
                              
                               per = l+m+n+o;
                               printf ("\n EL PERIMETRO DEL TRAPECIO ES: %.2f", per) ;
                              
                               area =h*b1+b/2 ;
                               printf ("\n EL AREA DEL TRAPECIO ES: %.2f", area) ;
                }
                               if (op==9)
                {
               
                               printf ("\n HEXAGONO:");
                               printf ("\n Introduzca base:");
                               scanf ("%d", &b);
                               printf ("\n Introduzca apotema:");
                               scanf ("%d", &a1);
                              
                              
                               per = pow(b,6);
                               printf ("\n EL PERIMETRO DEL HEXAGONO ES: %.2f", per) ;
                              
                               area = per*a1/2;
                               printf ("\n EL AREA DEL HEXAGONO  ES: %.2f", area) ;
                }             
                if (op==10)
                {
               
                               printf ("\n ECLIPSE:");
                               printf ("\n Introduzca Semieje Menor:");
                               scanf ("%d", &s);
                               printf ("\n Introduzca semieje Mayor:") ;
                               scanf ("%f", &s1);
               
                               per = 0;
                               printf ("\n NO SE PUEDE CALCULAR PERIMETRO: %.2f", per) ;
               
                               area = PI *s1*s ;
                               printf ("\n EL AREA DEL ECLIPSE  ES: %.2f", area) ;
                }
                if (op==11)
                {
               
                               printf ("\n TRAPECIO");
                               printf ("\n Introduzca lado 1:");
                               scanf ("%d", &l);
                               printf ("\n Introduzca lado 2:");
                                scanf ("%d", &m);
                               printf ("\n Introduzca lado 3:");
                               scanf ("%d", &n);
                               printf ("\n Introduzca lado 4:");
                               scanf ("%d", &o);
                              
                              
                               per = l+m+n+o;
                               printf ("\n EL PERIMETRO DEL TRAPECIO ES: %.2f", per) ;
                              
                               area =0;
                               printf ("\n NO SE PUEDE CALCULAR AREA: %.2f", area) ;
                }             
                              
                return 0;
}

No hay comentarios.:

Publicar un comentario