#include<stdio.h>
#include<conio.h>
void uppercase(char *);
void main()
{
char str1[90],str2[90];
clrscr();
printf("enter string: ");
gets(str1);
printf("\n\nyour string in lowercase: %s",str1);
uppercase(str1);
getch();
}
void uppercase(char *str2)
{
int i;
for(i=0; str2[i] != '\0'; i++)
{
if(str2[i] != ' ')
{
str2[i] = str2[i] - 32;
}
}
printf("\n\nyour string in uppercase: %s",str2);
}
/* output:
enter string: vrushal pandav
your string in lowercase: vrushal pandav
your string in uppercase: VRUSHAL PANDAV
*/
No comments:
Post a Comment