0% found this document useful (0 votes)
5 views2 pages

Coding

The document contains three C programs demonstrating string manipulation. The first program converts a string to lowercase, the second reverses a numeric string, and the third compares two strings for equality. Each program includes basic input/output operations and string handling functions.

Uploaded by

baldsatvik
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views2 pages

Coding

The document contains three C programs demonstrating string manipulation. The first program converts a string to lowercase, the second reverses a numeric string, and the third compares two strings for equality. Each program includes basic input/output operations and string handling functions.

Uploaded by

baldsatvik
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

#include <stdio.

h>
#include <string.h>
int main()
{

char str[30] = "SATVIK";


printf("%s\n",strlwr(str));

for(int i = 0;i<strlen(str);i++)
{
if(str[i]>64&&str[i]<91)
{
str[i]+=32;
}
}
printf("Lower case: %s",str);

return 0;
}
__________

#include <stdio.h>
#include <string.h>
int main()
{
int temp;
char s1[20] = "1234560";

// printf("%s",strrev(s1));

for(int i = 0;i<strlen(s1)/2;i++ )
{
temp = s1[i];
s1[i]=s1[strlen(s1)-i-1];
s1[strlen(s1)-i-1] = temp;
}

printf("\n%s",s1);

return 0;
}

_________________
#include <stdio.h>
#include <string.h>
int main()
{

int flag=0;
char s1[] = "Hello";
char s2[] = "Hi";

if(strcmp(s1,s2)==0)
printf("Same");
else
printf("Different");
for(int i = 0;s1[i]!='\0'||s2[i]!='\0';i++)
{
if(s1[i]!=s2[i])
{
flag = 1;
break;
}
}
if(flag==1)
printf("\nNot same");
else
printf("\nSame");

return 0;
}

You might also like