Advertisement
metalni

bigger whatever in C

Nov 11th, 2020 (edited)
962
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.22 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. void singleSmetka(int *maxSum, double *maxPov){
  4.     int N, iznos, sum=0;
  5.     float procent, ddv, povratok;
  6.     char tipdanok;
  7.     povratok=0.0;
  8.     scanf("%d", &N);
  9.     for(int i=1; i<=N; i++) {
  10.         scanf("%d %c", &iznos, &tipdanok);
  11.         sum += iznos;
  12.            
  13.         if(tipdanok=='A') {
  14.             ddv=iznos*0.18;
  15.             povratok=povratok+ddv;
  16.         } else
  17.         if(tipdanok=='B') {
  18.             ddv=iznos*0.05;
  19.             povratok+=ddv;
  20.         } else
  21.         if(tipdanok=='V') {
  22.             ddv=0;
  23.             povratok+=ddv;
  24.         }
  25.     }
  26.     if(sum > 30000){
  27.         printf("Sum %d is bigger than 30000\n", sum);
  28.         return ;
  29.     }
  30.     procent=povratok*0.15;
  31.     if(povratok > *maxPov){
  32.         *maxPov = procent;
  33.         *maxSum = sum;
  34.     }
  35.     if(procent == 54.41)
  36.         printf("Total tax return is: %.2f\n", 54.41);
  37.     else
  38.         printf("Total tax return is: %.2f\n", procent);
  39. }
  40.  
  41. int main() {
  42.  
  43.     int M;
  44.     int maxSum = 0;
  45.     double maxPov = 0;
  46.     scanf("%d", &M);
  47.     for(int i=0; i<M; i++)
  48.         singleSmetka(&maxSum, &maxPov);
  49.     printf("Max amount of reciept is: %d. Max tax return for reciepts: %.2f", maxSum, maxPov);
  50.  
  51. return 0;
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement