Table of Contents
show
strupr()
Converts uppercase string to lowercase
strupr(string_name);
Program: convert string to uppercase using string function
#include<stdio.h>
#include<string.h>
int main()
{
char s[100];
puts("Ener string in lowercase");
gets(s);
strupr(s);
puts("After converting to uppercase,");
puts(s);
return 0;
}
Output
Ener string in lowercase
hello
After converting to uppercase,
HELLO
Program: Convert lowercase to uppercase without using library function
#include<stdio.h>
#include<string.h>
int main()
{
char s[100];
int i=0;
puts("Enter string in lowercase");
gets(s);
while(s[i] != '\0')
{
if(s[i] >=97 && s[i]<=122)
{
s[i] = s[i] -32;
}
i++;
}
puts("After converting to uppercase");
puts(s);
return 0;
}
Output
Enter string in lowercase
itechbitz
After converting to uppercase
ITECHBITZ
Views: 0