c program to determine the datatype of input? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

c program to determine the datatype of input?

if you enter a charatcer ,integer or floating point number, the program should determine and display the type as output.

15th Jun 2017, 4:13 PM
Maansi Thakur
Maansi Thakur - avatar
1 Answer
+ 4
I can't code it now but basically you need to take the input into a string with scanf, and then parse it. If it contains a "." then it is a float. If it has an alphabetical (A to Z or a to z or any special char), then it is a char. If it has only numbers then it is an integer.
15th Jun 2017, 4:46 PM
Karl T.
Karl T. - avatar