hey guys..

using C language,

how can I ask the user to enter a positive integer

in only these forms --> binary, octal, decimal, or hexadecimal

then save it in a charachter array !

then I ask the use what's the base of this positive number..

and from here I can tell if the form is octel or decimal or .. etc ! ..

This is what I have done so far

#include <stdio.h>

int main()
	char posNumChar[30];

    printf("Please enter positive number: ");
    fgets(posNumChar, 30, stdin);

    printf("You entered this positive number, %s", posNumChar);


now I want to do the second step.. which is asking the user for the base of the number he entered..

I've been asked to avoid using scanf() to a character and using getchar() --- IN THIS STEP only !

is there any other functions that work the same way as scanf and getchar !! ..

Try to stick to one forum at a time, and only move on when they stop delivering what you want.

Many of the more experienced helpers frequent several forums, so this kind of broadcast at best pisses off the very people most likely to give you good advice.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.