This C code reads an integer input and displays it in octal and hexadecimal formats.
Here's what each part of the code does:
- #include <stdio.h>: Includes the standard input-output header file for handling input and output operations.
- int main(): Defines the main function of the program.
- int iplno;: Declares an integer variable named `iplno`.
- scanf("%d",&iplno); : Reads an integer input from the user and stores it in the variable `iplno`.
- printf("%o",iplno);: Prints the value of `iplno` in octal format using `%o`.
- printf("\n%x",iplno);: Prints the value of `iplno` in hexadecimal format using `%x`. `\n` adds a new line before printing the hexadecimal value.
- return 0;: Indicates successful completion of the program.
So, when you run this code,if you to enter an integer. After you enter a number, it will display that number in octal and hexadecimal formats on separate lines.
IPL match
c code:
#include <stdio.h>
int main()
{
int iplno;
scanf("%d",&iplno);
printf("%o",iplno);
printf("\n%x",iplno);
return 0;
}
0 Comments
if you have any doubt, plz let me know