Convert to Uppercase
String is an array of characters whose last element is '0'.The ascii value of A to Z is from 65 to 90 and that of a to z is from 97 to 122 So every character has to be checked for the range and then converted
/*
http://www.ProbCOMP.com
String is an array of characters whose last element is '\0'.The ascii value of A to Z is from 65 to 90 and that of a to z is from 97 to 122
So every character has to be checked for the range and then converted
*/
#include<stdio.h>
void main()
{
char name[10];
printf("enter a word of less than or equal to 10 letters\n:");
scanf("%s",name);
for(int i=0;name[i]!='\0';i++)
{
if(name[i]>97)
{
name[i]=name[i]-32;
}
}
printf("\n uppercase: %s",name);
}
Download Program


