Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- void singleSmetka(int *maxSum, double *maxPov){
- int N, iznos, sum=0;
- float procent, ddv, povratok;
- char tipdanok;
- povratok=0.0;
- scanf("%d", &N);
- for(int i=1; i<=N; i++) {
- scanf("%d %c", &iznos, &tipdanok);
- sum += iznos;
- if(tipdanok=='A') {
- ddv=iznos*0.18;
- povratok=povratok+ddv;
- } else
- if(tipdanok=='B') {
- ddv=iznos*0.05;
- povratok+=ddv;
- } else
- if(tipdanok=='V') {
- ddv=0;
- povratok+=ddv;
- }
- }
- if(sum > 30000){
- printf("Sum %d is bigger than 30000\n", sum);
- return ;
- }
- procent=povratok*0.15;
- if(povratok > *maxPov){
- *maxPov = procent;
- *maxSum = sum;
- }
- if(procent == 54.41)
- printf("Total tax return is: %.2f\n", 54.41);
- else
- printf("Total tax return is: %.2f\n", procent);
- }
- int main() {
- int M;
- int maxSum = 0;
- double maxPov = 0;
- scanf("%d", &M);
- for(int i=0; i<M; i++)
- singleSmetka(&maxSum, &maxPov);
- printf("Max amount of reciept is: %d. Max tax return for reciepts: %.2f", maxSum, maxPov);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement