C program to convert lowercase to an uppercase string using ASCII values
kw.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
kodingwindow@kw:~$ gcc kw.c kodingwindow@kw:~$ ./a.out
———————————————————————————————————————————
Program to convert lower to an uppercase string
———————————————————————————————————————————
Enter the string welcome
The uppercase string is WELCOME
———————————————————————————————————————————
kodingwindow@kw:~$
C program to convert lowercase to an uppercase string using toupper() function
kw.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
kodingwindow@kw:~$ gcc kw.c kodingwindow@kw:~$ ./a.out
———————————————————————————————————————————
Program to convert lower to an uppercase string
———————————————————————————————————————————
Enter the string welcome
The uppercase string is WELCOME
———————————————————————————————————————————
kodingwindow@kw:~$
Dear User, Thank you for visitng KodingWindow. If you are interested in technical articles, latest technologies, and our journey further, please follow us on LinkedIn.