diogoAlves

IFF/Introdução à Programação/Lista/65

Mar 1st, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.65 KB | None | 0 0
  1. //IFF - Introdução à Programação
  2. //Lista de Exercícios - 65
  3. #include<stdio.h>
  4. #include<locale.h>
  5.  
  6. int main(){
  7.     setlocale(LC_ALL,"Portuguese");
  8.     int quantidade[500],check=0;
  9.     float preco[500], total;
  10.     for (int i=0;i<500;i++){
  11.         if (check==0){
  12.             printf("Entre com a preço do produto, seguido de sua quantidade: R$");
  13.             scanf("%f%d",&preco[i],&quantidade[i]);
  14.             total+=preco[i]*quantidade[i];
  15.         }
  16.         if((check==0)&&(i==499)){
  17.             check=1;
  18.             i=0;
  19.         }
  20.         if (check==1){
  21.             printf("O valor arrecadado com o %dº produto foi R$%.2f.\n",i+1,preco[i]*quantidade[i]);          
  22.         }
  23.     }
  24.     printf("O valor total foi de R$%.2f", total);
  25.     return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment