This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main() | |
{ | |
int atoi (char s[]); | |
printf("%d",atoi("239")); | |
return 0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//count words, new line and characters | |
#include <stdio.h> | |
#define IN 1 | |
#define OUT 0 | |
int main() | |
{ | |
int c, nc, nl, nw, state; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//to count occurance of digits and white space and others | |
#include <stdio.h> | |
int main() | |
{ | |
int i,c,nwhites,nothers; | |
int ndigits[10]; | |
c=nwhites=nothers=0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* C programming source code to convert either binary to decimal or decimal to binary according to data entered by user. */ | |
/* From http://www.programiz.com/ */ | |
#include <stdio.h> | |
#include <math.h> | |
int binary_decimal(int n); | |
int decimal_binary(int n); | |
int main() | |
{ | |
int n; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* convert C to lower case | |
int lcase (int c) | |
{ | |
if (c >= 'A' && C <= 'Z') | |
retunr c + 'a' - 'A'; | |
else | |
return c; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void strct(char s[],char t[]); | |
int main() | |
{ | |
char s[7] = "mehul "; | |
char t[6] = "dhara"; | |
strct(s,t); | |
printf("%s",s); | |
return 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
unsigned getbits(unsigned x,int p,int n); | |
int main() | |
{ | |
printf("%d",getbits(5, 4, 3)); | |
return 0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
unsigned setbits(unsigned x, int p, int n, unsigned y); | |
int main() | |
{ | |
printf("%d", setbits(17, 4, 3, 13)); | |
return 0; | |
} | |
unsigned setbits(unsigned x, int p, int n, unsigned y) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int bitcount(unsigned x) | |
{ | |
int b; | |
for(b = 0;x != 0;x &= x-1) | |
++b; | |
return b; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
unsigned rightrot(unsigned x, unsigned n) | |
{ | |
while (n > 0) { | |
if ((x & 1) == 1) | |
x = (x >> 1) | ~(~0U >> 1); | |
else | |
x = (x >> 1); | |
n--; | |
} | |
return x; |
OlderNewer