C PROGRAM EXAMPLE FOR toupper() FUNCTION :

#include <stdio.h>
//#include<string.h>
int main() 
{
  int i;
  char str[20];
  printf("\n >>> C PROGRAM TO IMPLEMENT toupper() FUNCTION <<< \n");
  printf( "\n Enter the string in Lower or Mixed Case: ");
  //scanf("%s",&str); //scanf() wont allow spaces
  gets(str); //gets() allows apaces
  printf("\n The entered string in Upper Case is: ");
  for(i=0;i<=strlen(str);i++)
  {
      printf("%c",toupper(str[i]));
  }
  getch();
  return 0;
}

 

C Program ToUpper Function_Output
Sample Output


Leave a Reply

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