Pular para o conteúdo

Calculadora em C

Ai galera tive um trabalho na faculdade, e era pra faze uma calculadora bem simples em C, vou colocar aiw que é para se alguem precisar pra estudar ou ver como é .... abraçoa  todos
erico rojahn santos kernel_sys
Hits: 8.833 Categoria: C/C++ Subcategoria: Introdução
  • Download
  • Nova versão
  • Indicar
  • Denunciar

Descrição

Ai galera tive um trabalho na faculdade, e era pra faze uma calculadora bem simples em C, vou colocar aiw que é para se alguem precisar pra estudar ou ver como é .... abraçoa  todos
Download calculadora.c Enviar nova versão

Esconder código-fonte

#include <stdio.h>
#include <math.h>
float x;
float y;
float n;
float z;
int i;
int adicao ()
{
   system("clear");
   printf ("\nENTRE COM O PRIMEIRO VALOR: ");
   scanf ("%f",&x);
   printf ("\nENTRE COM O SEGUNDO VALOR: ");
   scanf ("%f",&y);
   
   printf ("\a\nA SOMA DE %.f COM %.f É %.f\n",x,y,x+y);

   system("sleep 2");
   
}

int subtracao ()
{
   system("clear");
   printf ("\nENTRE COM O PRIMEIRO VALOR: ");
   scanf ("%f",&x);
   printf ("\nENTRE COM O SEGUNDO VALOR: ");
   scanf ("%f",&y);

   printf ("\a\n%.f MENOS %.f é %.f\n",x,y,x-y);

   system("sleep 2");
   

}

int divisao ()
{
   system("clear");
   printf ("\nENTRE COM O PRIMEIRO VALOR: ");
   scanf ("%f",&x);
   printf ("\nENTRE COM O SEGUNDO VALOR: ");
   scanf ("%f",&y);
   
   printf ("\a\n%.f DIVIDINDO POR %.f é %.f\n",x,y,x/y);

  printf("Operação ilegal Maluco!!");

   system("sleep 2");
   
}

int multiplicacao ()
{
   system("clear");
   printf ("\nENTRE COM O PRIMEIRO VALOR: ");
   scanf ("%f",&x);
   printf ("\nENTRE COM O SEGUNDO VALOR: ");
   scanf ("%f",&y);

   printf ("\a\n%.f MULTIPLICANDO POR %.f é %.f\n",x,y,x*y);

   system("sleep 2");
   }

int porcentagem ()
{
float perce;
int z=100;
   system("clear");
   printf ("\nENTRE COM UM VALOR: ");
   scanf ("%f",&n);
   perce=((n)/100);
      printf ("\a\nA PORCENTAGEM É %.1f\n",perce);

   system("sleep 2");
   
}
   
int sair ()
{
   printf ("\n\t\t\t\t\t WAIT...\n");
   system("sleep 3");
   printf("\t\t\tTO FREE IT'S NECESSARY MIND IF IT IS ARMED\n");//para libertar sua mente se necessario arme-se
   printf("\t\t\t\t DESIGN OF ERICO R.SANTOS\n\n");
   return(0);
}

int main (void)
{
  for(i=1; i<2; i++){ 
   int resp;
   system("clear");
   printf ("\n\n\t\tQUAL OPERAÇÃO QUE DESEJA USAR?\n");
   printf ("\n\t\t(1)ADIÇAO(+)\n\t\t(2)SUBTRACAO(-)\n\t\t(3)DIVISAO(/)\n\t\t(4)MULTIPLICAÇAO(*)\n\t\t(5)PORCENTAGEM(%)\n\t\t(6)SAIR\n");
   printf ("\n :");
   scanf ("%d",&resp);
    
   switch (resp)
      {
      case 1:
        adicao();
      break;
      case 2:
        subtracao();
      break;
      case 3:
        divisao();
      break;
      case 4:
        multiplicacao();
      break;
      case 5:
        porcentagem ();
      break;
      case 6:
        sair();
      break;
   default: printf("\n\t\tIT DOES NOT HAVE THIS OPTION DONKEY!!!\n\n");
      }

   return(0);
}
}

Dado

Agenda de Contatos v1.0

Janela

fibonacci

Tabela ASCII Em C

#1 Comentário enviado por nexushu em 30/11/2005 - 17:27h
Po calculadora em C e maoir legal valeu pelos codigos

Contribuir com comentário

Entre na sua conta para comentar.