Ans. Algorithm:
Step 1: Input NUM
Step 2: LEN = 0 & Y=NUM
Step 3: While (Y > 0)
HEXD[LEN]=Y%16
Y=Y/16
LEN++
Step 4: for(I=LEN-1;I>-1;I–)
IF(HEXD[I]<10)
HEXC[I]=HEXD[I]+48;
ELSE
HEXC[I]=HEXD[I]+55;
Step 5: HEXC[I]=NULL
Step 5: Print HEXC
Program:
#include<stdio.h>
#include<math.h>
#include<conio.h>
int main()
{
int
decimal_number, remainder, hexadecimal_number = 0;
int
count = 0;
scanf("Enter
a Decimal Number:\t");
scanf("%d",
&decimal_number);
while(decimal_number
!= 0)
{
remainder
= decimal_number % 16;
hexadecimal_number
= hexadecimal_number + remainder * pow(10, count);
decimal_number
= decimal_number / 16;
count++;
}
scanf("\nHexadecimal
Equivalent:\t%d\n", hexadecimal_number);
return
0;
getch();
}
The algorithm is very easy. If to follow the structure, we can easily complete the task successfully. I think that everyone will be able to use this guideline to draw a line with endpoints.
ReplyDeleteghatiya algorithm hai
ReplyDeleteit needs correction after__int count =0;
ReplyDeletethere is printf() -- not scanf...
and also in the last statement there is also printf()--not scanf ..
ReplyDeleteHayatımızda yeni şeyler öğrenmek ve kendimizi geliştirmek adına çeşitli yollar deniyoruz. Bu süreçte, farklı bakış açıları kazandıran ve ilham veren eserler oldukça önemli oluyor. Özellikle, ilginizi çekebilecek kitap önerileri sayesinde, okuma alışkanlığınızı geliştirebilir ve yeni dünyalara adım atabilirsiniz. Bu nedenle, kendinizi sürekli olarak yenilemek ve genişletmek adına okuma listelerinize mutlaka eklemelisiniz.