Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <locale.h> // здесь "живёт" setlocale(LC_ALL, "rus");
- /////////////////////////////////////////////////////
- int main()
- {
- setlocale(LC_ALL, "rus");
- int n = 0,
- nSerial = 0,
- nOstato = 0,
- nSumma = 0;
- printf("Введите количество книг: "); scanf("%d", &n);
- nSerial = n / 7; // printf("nSerial = %d\n", nSerial);
- nOstato = n % 7; // printf("nOstato = %d\n", nOstato);
- //
- switch(nOstato)
- {
- case 0: nSumma = 0; break;
- case 1: nSumma = 1000; break;
- case 2: nSumma = 1945; break;
- case 3: nSumma = 2835; break;
- case 4: nSumma = 3670; break;
- case 5: nSumma = 4450; break;
- case 6: nSumma = 5175; break;
- case 7: nSumma = 5845; break;
- }
- nSumma = nSumma + (5845 * nSerial); // nSumma += 5845 * nSerial;
- printf("Общая стоимость %d книг = %d\n", n, nSumma);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement