Question: anyone knows an efficient way to check out the format of an scanf'ed data?

e.g. if I try to read an integer and I type a character, how would you do to tell the program that is not correct?

Answer: 
```
scanf("%s", &c);
if(!atoi(c)) puts("You have entered a character");
if(atoi(c) != 0) puts("You have entered an integer");

```
```
Scanner sc = new Scanner (System.in);

try {

       // assume that the input from the user is not an integer, 
       // in that case the program cannot convert the input (which is a String) into
       // an integer. Because of this situation it'll jump to the 'catch' part of the 
       // program and execute the code. 

       int input = Integer.valueOf(sc.nextInt);

       // if the input is an integer lines below the above code will be executed. 

       // Ex. "int x = ( input + 10 ) "

}

catch (Exception ex) {

        System.out.println("Invalid input, please retry!");

        // if you want to get more information about 
        // the error use the 'ex' object as follows.

        System.out.println(ex);

}

```