Logo 
Search:

C Programming Articles

Submit Article
Home » Articles » C Programming » Homework HelpRSS Feeds

Program to read string using gets() function and display in upper case

Posted By: Adelbert Fischer     Category: C Programming     Views: 8291

Program to read string using gets() function and display in upper case.

Code for Program to read string using gets() function and display in upper case in C Programming

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

void upper(char[]);

int main()
{
    char str[20];
    clrscr();
    printf("Enter string : ");
    gets(str);
    upper(str);
    getch();
    return 0;
}

void upper(char str[20])
{
    int i;
    printf("%s in upper case is ",str);
    for(i=0;str[i];i++)
    {
        if(str[i]>96 && str[i]<123)
            str[i]-=32;
    }
    printf("%s",str);
}



Output:

Enter string : Syntax
Syntax in upper caseis SYNTAX
  
Share: 



Adelbert Fischer
Adelbert Fischer author of Program to read string using gets() function and display in upper case is from Frankfurt, Germany.
 
View All Articles

Related Articles and Code:


 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!