Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Buy a domain name - Register cheap domain names from $0.99 - Namecheap

Scalable Hosting That Grows With You

Secure & Reliable Web Hosting, Free Domain, Free SSL, 1-Click WordPress Install, Expert 24/7 Support

Semrush - keyword research tool

Boost your online presence with premium web hosting and servers

Disclosure: My content contains affiliate links.

39,970 questions

51,912 answers

573 users

How to convert lowercase letter to uppercase without library functions in C

3 Answers

0 votes
#include <stdio.h>
  
int main(void)
{
    char s[] = "The last line Of code";
    int i;
    
    // A - 65 .. Z - 90 (ASCII)
    // a - 97 .. Z - 122 (ASCII)
    // 97 - 65 = 32 

    while (s[i])
	{
        if (s[i] >= 97 && s[i] <= 122)
			s[i] = s[i] - 32;
		i++;
	}
	puts(s);
     
    return 0;
}
  
   
/*
     
run:
     
THE LAST LINE OF CODE

*/

 



answered Jan 29, 2016 by avibootz
edited Jan 29, 2016 by avibootz
0 votes
#include <stdio.h>
   
int main(void)
{
    char s[] = "The last line Of code";
    int i;
     
    // A - 65 .. Z - 90 (ASCII)
    // a - 97 .. Z - 122 (ASCII)
    // 97 - 65 = 32 
 
    while (s[i])
	{
        if (s[i] >= 'a' && s[i] <= 'z')
            s[i] = s[i] - 32;
		i++;
	}
     
    puts(s);
      
    return 0;
}
   
    
/*
      
run:
      
THE LAST LINE OF CODE
 
*/

 



answered Jan 29, 2016 by avibootz
0 votes
#include <stdio.h>
    
int main(void)
{
    char s[] = "The last line Of code";
    int i;
      
    // A - 65 .. Z - 90 (ASCII)
    // a - 97 .. Z - 122 (ASCII)
    // 97 - 65 = 32 
  
    while (s[i])
    {
        if (s[i] >= 'a' && s[i] <= 'z')
            s[i] = 'A' + s[i] - 'a';
        i++;
    }
      
    puts(s);
       
    return 0;
}
    
     
/*
       
run:
       
THE LAST LINE OF CODE

*/

 



answered Jan 29, 2016 by avibootz

Related questions

...