mirror of
https://github.com/TheAlgorithms/C
synced 2024-11-22 13:31:21 +03:00
updated with the suggested changes
This commit is contained in:
parent
19fb5ba4dd
commit
e2444cee18
@ -5,11 +5,11 @@
|
|||||||
* return a string hexadecimal value after conversion
|
* return a string hexadecimal value after conversion
|
||||||
* @author [Rachit Bhalla](https://github.com/rachitbhalla)
|
* @author [Rachit Bhalla](https://github.com/rachitbhalla)
|
||||||
*/
|
*/
|
||||||
#include <assert.h>
|
#include <assert.h> // for assert
|
||||||
#include <math.h>
|
#include <math.h> // for pow function
|
||||||
#include <stdio.h>
|
#include <stdio.h> // for scanf and printf functions
|
||||||
#include <stdlib.h>
|
#include <stdlib.h> // for malloc and free functions
|
||||||
#include <string.h>
|
#include <string.h> // for strcmp function
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Convert octal number to decimal number
|
* @brief Convert octal number to decimal number
|
||||||
@ -57,16 +57,16 @@ static void test() {
|
|||||||
*/
|
*/
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
//execute the tests
|
// execute the tests
|
||||||
test();
|
test();
|
||||||
|
|
||||||
int octalValue;
|
int octalValue;
|
||||||
printf("Enter an octal number: ");
|
printf("Enter an octal number: ");
|
||||||
scanf("%d", &octalValue);
|
scanf("%d", &octalValue);
|
||||||
|
|
||||||
//Calling the function octalToHexadecimal
|
// Calling the function octalToHexadecimal
|
||||||
char *hexadecimalValue = octalToHexadecimal(octalValue);
|
char *hexadecimalValue = octalToHexadecimal(octalValue);
|
||||||
printf("\nEquivalent hexadecimal number is: %s", hexadecimalValue);
|
printf("Equivalent hexadecimal number is: %s", hexadecimalValue);
|
||||||
free(hexadecimalValue);
|
free(hexadecimalValue);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user