in turboc++
--------------------------------------------------------------------------------------------------
//program to convert given string into lowercase without strlwr()
#include <stdio.h>
#include <stdlib.h>
#include<conio.h>
int main()
{
char string[100];
int i;
printf("enter a string in uppercase\n");
gets(string);//INPUT
for(i=0;string[i]!='\0';i++)//LOOP EXECUTION
{
if(string[i]!=' ')//CONDITION TESTING
printf("%c",string[i]+32);//CONVERTING INTO LOWERCASE BY ADDING 32
else
printf(" ");//PRINTING SPACE
}
getch();
return 0;
}
--------------------------------------------------------------------------------------------------
//program to convert given string into lowercase without strlwr()
#include <stdio.h>
#include <stdlib.h>
#include<conio.h>
int main()
{
char string[100];
int i;
printf("enter a string in uppercase\n");
gets(string);//INPUT
for(i=0;string[i]!='\0';i++)//LOOP EXECUTION
{
if(string[i]!=' ')//CONDITION TESTING
printf("%c",string[i]+32);//CONVERTING INTO LOWERCASE BY ADDING 32
else
printf(" ");//PRINTING SPACE
}
getch();
return 0;
}
--------------------------------------------------------------------------------------------------------------
in codeblocks:
-------------------------------------------------------------------------------------------------------------------
//program to convert given string into lowercase without strlwr()
#include <stdio.h>
#include <stdlib.h>
int main()
{
char string[100];
int i;
printf("enter a string in uppercase\n");
gets(string);//INPUT
for(i=0;string[i]!='\0';i++)//LOOP EXECUTION
{
if(string[i]!=' ')//CONDITION TESTING
printf("%c",string[i]+32);//CONVERTING INTO LOWERCASE BY ADDING 32
else
printf(" ");//PRINTING SPACE
}
return 0;
}
No comments:
Post a Comment