0

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 ! ..

2
Contributors
2
Replies
3
Views
10 Years
Discussion Span
Last Post by Salem
0

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);

    getchar();
}

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 !! ..

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.