Scan a number along with its base value. If a number starts with 0, it indicates an octal value. If a number starts with 0x it indicates that the number is a Hexadecimal value. Print the Corresponding Decimal value. Using C- Program - Learn Engineering

All the news and updates relevant to Engineering. You can also Write a post here

Breaking

Wednesday, June 10, 2020

Scan a number along with its base value. If a number starts with 0, it indicates an octal value. If a number starts with 0x it indicates that the number is a Hexadecimal value. Print the Corresponding Decimal value. Using C- Program

Learn C programming

Question

Scan a number along with its base value. If a number starts with 0, it indicates an octal value. If a number starts with 0x it indicates that the number is a Hexadecimal value. Print the Corresponding Decimal value.

Sample TestCase Expected Output

1. 0xA10


2. 01715


Answer

#include <stdio.h>

int main()
{
    int num;
    scanf("%i",&num);
    printf("%d",num);
    return 0;
}


Comment What problem Do you Need...

Follow Us For More...

1 comment: