Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int main() {
- int N;
- scanf("%d", &N);
- int pom = N;
- int cetrvrta = N % 10;
- N /= 10;
- int treta = N % 10;
- N /= 10;
- int vtora = N % 10;
- N /= 10;
- int prva = N % 10;
- int brojac = 0;
- if(prva == 5) {
- brojac++;
- prva = 6;
- }
- if(vtora == 5) {
- brojac++;
- vtora = 6;
- }
- if(treta == 5) {
- brojac++;
- treta = 6;
- }
- if(cetrvrta == 5) {
- brojac++;
- cetrvrta = 6;
- }
- if(brojac < 2) {
- printf("ERROR\n");
- return 0;
- }
- int kolega = 1000 * prva + 100 * vtora + 10 * treta + cetrvrta;
- printf("%d ", kolega);
- float procent = ((100 * kolega) - (100 * pom)) / pom;
- printf("%f%%", procent);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement