Archive for December 2011

#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
long int n,i,k=1,rem=0,bin=0;
clrscr();

printf(“Enter any bianary value : “);
scanf(“%ld”,&n);

for(i=1;n>0;i++)
{
rem = n % 10;
bin = bin + (rem * k);
k = k * 2;
n = n / 10;
}
printf(“\n Your decimal no is = %ld”,bin);
getch();
}

No tags Hide

#include<stdio.h>

#include<conio.h>
void main()

{

clrcsr();

int a,b,c,d;

scanf(“%d”,&a);

scanf(“%d”,&b);

scanf(“%d”,&c);

d=a;

a=b;

b=c;

c=d;

printf(“%d\n”,a);

printf(“%d\n”,b);

printf(“%d\n”,c);

getch();

}

No tags Hide

#include<stdio.h>

#include<conio.h>
void main()

{

clrscr();

int a, b,c;

printf(“enter the 1 value”);

scanf(“%d”,&a);

printf(“enter the 2 value”);

scanf(“%d”,&b);

c=a+b;

printf(“sum is:%d”,c);

getch();

}

No tags Hide

#include<stdio.h>

#include<conio.h>

void main()

{

clrscr();

int a,b,c;

printf(“enter 1 value:”);

scanf(“%d”,&a);

printf(“enter 2 value:”);

scanf(“%d”,&b);

printf(“enter 3 value:”);

scanf(“%d”,&c);

if(a==b && b==c)

{

printf(“a,b,c are equal”);

}

else if(a==b)

if( a>c)

{

printf(“a=b is max”);

}

else

{

printf(“a=b and c is max”);

}

else if(b==c)

if(b>a)

{

printf(“b=c is max”);

}

else

{

printf(“b=c and a is max”);

}

else if(c==a)

if(c>b)

{

printf(“c=a is max”);

}

else

{

printf(“c=a and b is max”);

}

else if(a>b && a>c)

{

printf(“a is max”);

}

else if(b>a && b>c)

{

printf(“b is max”);

}

else if(c>a && c>b)

{

printf(“c is max”);

}
getch();

}

No tags Hide

Next »

Managed by

MNP INFOTECH