Advertisement
Raul_julian

Autoestrada-[OBI]

Jun 17th, 2013
331
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.39 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main() {
  4.  
  5.     int i, valor, soma=0, count=0;
  6.  
  7.     scanf("%d", &valor);
  8.    
  9.     char carac[valor];
  10.  
  11.         for(i=0; i<=valor; i++) {
  12.  
  13.         scanf("%c", &carac[i]);  
  14.    
  15.         if(carac[i] == 'P') count = count + 2;
  16.      
  17.         else if(carac[i] == 'C') count = count+2;
  18.  
  19.         else if(carac[i] == 'A') count++;
  20.    
  21.         else count = count + 0;   }
  22.  
  23.     printf("%d", count);
  24.  
  25.     return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement