#include<stdio.h>
#include<conio.h>
void upper_string(char*);
void main()
{
char string[100];
clrscr();
printf("Enter a string to convert it into upper case\n");
gets(string);
upper_string(string);
printf("Entered string in upper case is \"%s\"\n", string);
getch();
}
void upper_string(char *string)
{
while(*string)
{
if ( *string >= 'a' && *string <= 'z' )
{
*string = *string - 32;
}
string++;
}
}
#include<conio.h>
void upper_string(char*);
void main()
{
char string[100];
clrscr();
printf("Enter a string to convert it into upper case\n");
gets(string);
upper_string(string);
printf("Entered string in upper case is \"%s\"\n", string);
getch();
}
void upper_string(char *string)
{
while(*string)
{
if ( *string >= 'a' && *string <= 'z' )
{
*string = *string - 32;
}
string++;
}
}
No comments:
Post a Comment