Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. void task_1(char *iban, char expr[MAX_TEXTLEN])
  2. {
  3. /* REPLACE FOLLOWING LINE WITH YOUR SOLUTION */
  4. // task_1_DEMO(iban, expr);
  5.  
  6.  
  7. char chars[4]={iban[0],iban[1],iban[2],iban[3]};
  8.  
  9. int counter=0;
  10. for (int i = 0; iban[i] !='\0'; ++i)
  11. {
  12. if(iban[i+4]!= '\0'){
  13. iban[i]=iban[i+4];
  14. }else {
  15. counter=i;
  16. break;
  17. }
  18. }
  19. for(int i =0; i < 4; ++i){
  20. iban[counter]=chars[i];
  21. counter++;
  22.  
  23. }
  24.  
  25. counter = 0;
  26. for (int i = 0; iban[i] != '\0'; ++i)
  27. {
  28. if (isdigit(iban[i]) ==0)
  29. {
  30. int number = (int) iban[i] - 55;
  31. expr[counter]= (number /10) + '0';
  32. expr[counter+1]= (number%10) + '0';
  33. counter+=2;
  34. }
  35. else{
  36. expr[counter]=iban[i];
  37. counter++;
  38. }
  39. }
  40.  
  41. expr[counter+1]=' ';
  42. expr[counter+2]= '%';
  43. expr[counter+3]= ' ';
  44. expr[counter+4]= '9';
  45. expr[counter+5]='7';
  46. expr[counter+6]='\0';
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement