Advertisement
Guest User

Untitled

a guest
Feb 27th, 2020
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. while ( secretcode<48 || secretcode>122){ /*According to the ASCII TABLE;0-9 has ASCII code of 48-57 and uppercase letters (A-Z)have ASCII code of 65-90 and lowercase characters have ASCII code of 98-122.So that it is certain that secretcode should not be lower than 48 and upper than 122.*/
  2. printf("ERROR! The user entered another character,so enter another character again!\n");
  3. scanf("\n%c",&secretcode);}
  4.  
  5. while (secretcode>0){ /* I will use this algorithm to convert decimal numbers to binary form */
  6.  
  7. remainder= secretcode%2;
  8. power=pow(10,place);
  9.  
  10. binary=binary+(remainder*power);
  11. place++;
  12. secretcode=secretcode/2;}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement