diogoAlves

IFF/Introdução à Programação/Slide/Pag 33/Ex 4

Feb 21st, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.71 KB | None | 0 0
  1. //IFF - Introdução à Programação
  2. //Slide - Página 33 - Exercício 4
  3. #include<stdio.h>
  4. #include<locale.h>
  5.  
  6. int main(){
  7.     setlocale(LC_ALL,"Portuguese");
  8.     float saldo, valor;
  9.     int resp;
  10.     printf("Sistema básico financeiro.\n");
  11.     do{
  12.         printf("1 - Depósito \n2 - Retirada \n3 - Saldo \n4 - Sair\nOpção: ");
  13.         scanf("%d",&resp);
  14.         switch (resp){
  15.             case 1:
  16.                 printf("\nEntre com o valor a ser depositado: R$");
  17.                 scanf("%f",&valor);
  18.                 saldo+=valor;
  19.             break;
  20.             case 2:
  21.                 printf("\nEntre com o valor a ser sacado: R$");
  22.                 scanf("%f",&valor);
  23.                 saldo-=valor;
  24.             break;
  25.             case 3:
  26.                 printf("\nSeu saldo é de R$%.2f",saldo);
  27.             break;
  28.         }
  29.     printf("\n");
  30.     }while(resp != 4);
  31. }
Advertisement
Add Comment
Please, Sign In to add comment