Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I am trying to check in C if an input is integer or a character or symbols like

ID: 3807032 • Letter: I

Question

I am trying to check in C if an input is integer or a character or symbols like .,!% etc.
I use scanf but it doesn't seems to work properly.
Source code:

printf("Enter the number ")

scanf ("%d",&number);

if (scanf("%d",&number!=1))

{printf("Not a integer ");}

Any ideas for a better code?

In my case firstly i have to exclude characters, all symbols like (,)(!) (#) (*) etc., pressing spacebar or even no input at all. After excluding all these i have to conclude (--> else) that input was integer. That is why i was trying to use scanf. Any ideas?

Explanation / Answer

Try This:

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote