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