PK SOLVED

  • Home
  • Request solution
  • About

17 Jan 2017

C program to change case of string

 C     No comments   


In this post, you learn how to change the case of string. If you entered "A", the program will change it's case to "a" and vise-versa. Refer following examples:

#Example: Uppercase to Lowercase (strlwr)

  
  #include <stdio.h>
  #include <string.h>
  void main()
  {
     char inpString[1000];
     char lwrString[1000];
     
     printf("Enter a string to convert to lower case:\n");
     gets(inpString);
     lwrString = strlwr(inpString);
 
     printf("Your string in lower case: \"%s\"\n",lwrString);
 
  }

Output

  Enter a string to convert to lower case:
  HELLO
  Your string in lower case:
  hello

#Example: Lowercase to Uppercase (strupr)

  #include <stdio.h>
  #include <string.h>
  void main()
  {
     char inpString[1000];
     char uprString[1000];
     
     printf("Enter a string to convert to upper case:\n");
     gets(inpString);
     uprString = strlwr(inpString);
 
     printf("Your string in upper case: \"%s\"\n",uprString);
 
  }

Output

  Enter a string to convert to upper case:
  hello
  Your string in upper case:
  HELLO
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg
Older Post Home

0 comments:

Post a Comment

Contact Form

Name

Email *

Message *

About me

Hi, this is Pankaj Takale, a programming lover. This blog created to help programmers who are getting stuffs while doing their best.

Follow me here to be in touch

Popular Posts

  • C program to find whether it is prime number or not
    C program to find whether it is prime number or not: Prime number is the number which can only divided by one (1) and itself. ...
  • C program to implement structure
    Structure is a user-defined data type in C which allows you to combine different data types to store a particular type of record. Stru...
  • C program to change case of string
    In this post, you learn how to change the case of string. If you entered "A", the program will change it's case to ...
  • C program to check leap year
    C program to check leap year: A leap year is exactly divisible by 4 except for century years (years ending with 00). The century yea...
  • C program to print Fibonacci series
    C program to print fibonacci series: The Fibonacci sequence is a series where the next term is the sum of pervious two terms. The fir...

Blog Archive

  • ▼  2017 (13)
    • ▼  January (13)
      • C program to change case of string
      • C program to implement structure
      • C program to check whether it is positive number o...
      • C program to check leap year
      • C program to find whether it is prime number or not
      • C program to print Fibonacci series
      • C program to check whether it is armstrong number ...
      • C program to swap two number without temporary var...
      • C program to swap two numbers using temporary vari...
      • C program to check whether entered character is Vo...
      • C program to print ASCII value of character
      • C program to print palindrome number
      • C program to print even & odd number

Copyright © PK SOLVED