C program to convert lowercase to an uppercase string using ASCII values
codeaft.c
#include<stdio.h>
#include<string.h>intmain(){chars[20];inti;printf("———————————————————————————————————————————");printf("\nProgram to convert lower to an uppercase string");printf("\n———————————————————————————————————————————");printf("\nEnter the string ");scanf("%s",s);for(i=0;i<=strlen(s);i++){if(s[i]>=97&&s[i]<=122)s[i]=s[i]-32;}printf("\nThe uppercase string is %s",s);printf("\n———————————————————————————————————————————\n");return0;}
Output
codeaft@codeaft:~$ gcc codeaft.c codeaft@codeaft:~$ ./a.out
———————————————————————————————————————————
Program to convert lower to an uppercase string
———————————————————————————————————————————
Enter the string welcome
The uppercase string is WELCOME
———————————————————————————————————————————
codeaft@codeaft:~$
C program to convert lowercase to an uppercase string using toupper() function
codeaft.c
#include<stdio.h>intmain(){chars[20];inti;printf("———————————————————————————————————————————");printf("\nProgram to convert lower to an uppercase string");printf("\n———————————————————————————————————————————");printf("\nEnter the string ");scanf("%s",s);for(i=0;s[i];i++)s[i]=toupper(s[i]);printf("\nThe uppercase string is %s",s);printf("\n———————————————————————————————————————————\n");return0;}
Output
codeaft@codeaft:~$ gcc codeaft.c codeaft@codeaft:~$ ./a.out
———————————————————————————————————————————
Program to convert lower to an uppercase string
———————————————————————————————————————————
Enter the string welcome
The uppercase string is WELCOME
———————————————————————————————————————————
codeaft@codeaft:~$
Dear User, Thank you for visitng Codeaft. If you are interested in technical articles, latest technologies, and our journey further, please follow us on LinkedIn.