Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 1

VIRTUAL LAB ASSIGNMENT 6

AIM: - Write a C Program to convert string from lower case to upper


case

PROGRAM: -

#include <stdio.h>
#include <string.h>
char string[1000];
void convertLowerToUpper() {
int i;
for (i = 0; string[i] != '\0'; i++) {
if (string[i] >= 'a' && string[i] <= 'z') {
string[i] = string[i] - 32;
}
}
}
int main() {
printf("\nEnter the string : ");
gets(string);
convertLowerToUpper();
printf("\nThe String in Upper Case = %s", string);
return 0;
}

OUTPUT: -
Enter the string: lower to upper
The String in Upper Case = LOWER TO UPPER

Result: - In this C Programming example, we have discussed how to convert a


string from lower case to upper case using the ASCII values.

You might also like