Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int GetInt(){
- int i;
- unsigned char c[2] = {30,30};
- int symbol = 0;
- unsigned short int err_f = 0;
- printf("Enter: ");
- scanf("%s", &c);
- for (i=0; i<2; i++){
- if(0x30 <= c[i] && c[i] <= 0x39){
- symbol *= 10;
- symbol += (c[i] - 0x30);
- } else {
- err_f = 1;
- }
- }
- if (err_f)
- return(GetInt());
- return(symbol);
- }
- int main()
- {
- int k = GetInt();
- printf("%d", k);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement