Advertisement
Guest User

Untitled

a guest
Dec 11th, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. int main()
  2. {
  3. char chVal;
  4. int sum = 0;
  5. int chIndex;
  6. int polje[50];
  7. int brojac = 0;
  8. int uvjet;
  9. do{
  10. scanf("%c", &chVal);
  11. if ((chVal >= '0') && (chVal <= '9')) {
  12. chIndex = chVal - '0';
  13. }
  14. else if ((chVal >= 'a') && (chVal <= 'z')) {
  15. chIndex = chVal - 'a' + 10;
  16. }
  17. else if ((chVal >= 'A') && (chVal <= 'Z')) {
  18. chIndex = chVal - 'A' + 10;
  19. }
  20. polje[brojac] = chIndex;
  21. brojac ++;
  22. if (chVal == ' '){
  23. uvjet = 0;
  24. }
  25. if (chVal == '\n'){
  26. uvjet = 0;
  27. }
  28. }while (uvjet == 0);
  29.  
  30. int i;
  31. for (i = 0; i < brojac; i++){
  32. sum = sum + pow(polje[i] , brojac);
  33. brojac -- ;
  34. }
  35. printf("%d", sum);
  36. return 0;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement