1. Proram to Convert Decimal To Binary and Print It(C-Lang)
void main()
{
int a=0,b=0,n,i=1,j,k=0;
int ar[10]={0,0,0,0,0,0,0,0,0,0};
clrscr();
printf(“\n Enter the decimal number”);
scanf(“%d”,&n);
while(n!=0)
{
a=n%2;
b=n/2;
ar[i++]=a;
n=b;k++;
}
for(j=k+1;j>=1;j–)
printf(“%d”,ar[j]);
getch();
}
————————————————————————————————
2. A function to sort three number entered by the user( C++)
void sort(int a, int b , int c)
{
int t;
if (a>b)
{
t=b;b=a;a=t;
}
if (a>c)
{
t=c;c=a;a=t;
}
if (b>c)
{
t=b;b=c;c=t;
}
cout^^a^^b^^c;
}
Note : Extraction Operators are not working due to HTML tags, so I use ^^ instead of them