Convert String to Upper Case – C Program

Convert String to Upper Case – C Program

Write a C Program to convert given string to upper case letter.

#include<stdio.h>
#include<conio.h>

void main()
{
 char str[100];
 int i;
 printf("Please, Enter the String = ");

 gets(str);
 
 for(i=0;str[i]!=NULL;i++)
 {
  if(str[i]>='a'&&str[i]<='z')
   str[i]-=32;
 }
 
 printf(" \n The Upper case String is = %s",str);

}

The out put of upper case string example is :

Please, Enter the String = meera

The Upper case String is = MEERA

 

 

Author: Meera Academy

Leave a Reply

Your email address will not be published. Required fields are marked *