WELCOME TO MY BLOG BY SHABEEB.K

C,C++ PROGRAMMING: 08/03/13

Search This Blog

Saturday, 3 August 2013

CONVERT DECIMAL NUMBER TO BINARY


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
int n,k=0,b[10],i=0;
clrscr();
printf("ENTER A NUMBER\n");
scanf("%d",&n);
while(n>0)
{
b[i]=n%2;
n=n/2;
i++;
k++;
}
for(i=k-1;i>=0;i--)
{
printf("%d",b[i]);
}
getch();
}


OUTPUT


COMPARE STRINGS.


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
int n;

char string1[50],string2[50];

clrscr();

puts("\n ENTER ANY WORD \t");

gets(string1);

puts("\n ENTER SECOND WORD \t");

gets(string2);

n=strcmp(string1,string2);

if(n==0)

puts("\t BOTH SIZE OF STRINS ARE EQUAL\n");

else if(n<0)

puts("\n \t THE FIRST STRING IS GREATER\n ");

else if(n>0)

puts(" \n \t THE FIRST STRING IS SMALLER \n");

getch();
}


                                                                  OUTPUT

                                                                



ADD NEW NAME TO END OF TO ANOTHER STRING.


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
#include<stdio.h>
#include<conio.h>
void main()
{
char string1[80],string2[80];

clrscr();

printf("ENTER FIRST STRING\n");
scanf("%s",&string1);

printf("ENTER SECOND STRING\n");
scanf("%s",&string2);

strcat(string1,string2);

printf("BOTH STRINGS JOINED TOGETHER IS %s",string1);

getch();
}


                                                         

                                                                      OUTPUT

CONVERT UPPER CASE CHARACTER TO LOWER.


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
char word[80];
clrscr();

printf("ENTER ANY WORD OR NAME\n");
scanf("%s",&word);

strlwr(word);

printf("conevterd to %s ",word);
getch();
}

                    



OUTPUT


CONTACT ME ON FACEBOOK:  
SEND A FRIEND REQUEST                                     MESSAGE ME

CONVERT ALL LOWER CASE CHARACTER TO UPPER CASE.


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
char word[80];
clrscr();

printf("ENTER ANY WORD OR NAME\n");
scanf("%s",&word);

strupr(word);

printf("conevterd to %s ",word);
getch();
}

   


                                                                     OUTPUT

FIND LENGTH OF A CHARACTER.


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
char word[80];
int len;
printf("ENTER ANY WORD OR NAME\n");

scanf("%s",&word);
len=strlen(word);
printf("U HAVE ENTERED %d CHARACTERS\n",len);
}


                                                                   OUTPUT


BY SHABEEB KUPPANATH
contact in facebook
www.facebook.com/shabeeblive

DISPLAY REVERS OF A CHARACTER

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
char a[80];

clrscr();

printf("ENTER A WORD \n");
scanf("%s",&a);

strrev(a);

printf("REVERSE OF THE CHARACTER U ENTERED IS %s",a);
getch();
}



OUTPUT



Contact me in facebook: www.facebook.com/shabeeblive

SUM OF TWO NUMBERS.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,c;

printf("ENTER FIRST NUMBER \n");

scanf("%d",&a);

printf("ENTER SECOND NUMBER\n");
scanf("%d",&b);

c=a+b;

printf("SUM IS %d",c);

getch();
}

                                                                   OUTPUT