Advertisement
Guest User

Untitled

a guest
Mar 19th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main() {
  4. int a;
  5. int b;
  6. char num[1024];
  7.  
  8. //Step1
  9. printf("Please enter the number's base:\n");
  10. scanf("%d",&a);
  11. if(a<2 || a>16) {
  12. printf("Invalid input base\n");
  13. return 0;
  14. }
  15. //Step2
  16. printf("Please enter the desired base:\n");
  17. scanf("%d",&b);
  18. if(b<2 || b>16) {
  19. printf("Invalid desired base\n");
  20. return 0;
  21. }
  22.  
  23. //Step3
  24. printf("Please enter a number in base <%d>:\n",a);
  25. int i=0;
  26. while (i<5){
  27. scanf("%c", &num[i]);
  28. i++;
  29. }
  30. /*
  31. printf("Your number is: ");
  32. int j=0;
  33. for (j = 0; j < length(num); ++j) {
  34. printf("%c",num[i]);
  35. }
  36. printf("\n");
  37. */
  38. return 0;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement