Computer Science, asked by abedhashimi7235, 1 year ago

Write a Program which accept a Character and convert it into upper case.

Answers

Answered by BrainlyTech
0

#include <stdio.h>

#include <string.h>

 

int main()

{

  char string[1000];

   

  printf("Input a string to convert to lower case\n");

  gets(string);

   

  printf("The string in lower case: %s\n", strlwr(string));

   

  return  0;

}

#include <stdio.h>

#include <string.h>

 

int main()

{

  char string[1000];

   

  printf("Input a string to convert to upper case\n");

  gets(string);

   

  printf("The string in upper case: %s\n", strupr(string));

   

  return  0;

}

#include <stdio.h>

 

void upper_string(char []);

 

int main()

{

  char string[100];

   

  printf("Enter a string to convert it into upper case\n");

  gets(string);

   

  upper_string(string);

   

  printf("The string in upper case: %s\n", string);

     

  return 0;

}

 

void upper_string(char s[]) {

  int c = 0;

   

  while (s[c] != '\0') {

     if (s[c] >= 'a' && s[c] <= 'z') {

        s[c] = s[c] - 32;

     }

     c++;

  }

}

#include <stdio.h>

 

void lower_string(char []);

 

int main()

{

  char string[100];

   

  printf("Enter a string to convert it into lower case\n");

  gets(string);

   

  lower_string(string);

   

  printf("The string in lower case: %s\n", string);

     

  return 0;

}

 

void lower_string(char s[]) {

  int c = 0;

   

  while (s[c] != '\0') {

     if (s[c] >= 'A' && s[c] <= 'Z') {

        s[c] = s[c] + 32;

     }

     c++;

  }

}

#include <stdio.h>

 

int main ()

{

  int c = 0;

  char ch, s[1000];

 

  printf("Input a string\n");

  gets(s);

   

  while (s[c] != '\0') {

     ch = s[c];

     if (ch >= 'A' && ch <= 'Z')

        s[c] = s[c] + 32;

     else if (ch >= 'a' && ch <= 'z')

        s[c] = s[c] - 32;  

     c++;  

  }

   

  printf("%s\n", s);

 

  return 0;

}

⭐Mark as brainliest⭐

Hope this is what your looking for!!

Answered by aditya1984
0
#include <stdio.h>;

int main()
{
char lower, upper;

printf("Please input a character: ");

scanf("%c", &lower);

if(lower >= 'a' && lower <= 'z'){
upper = ('A' + lower - 'a');
}
else{
upper = lower;
}

printf("nThe uppercase equivalent is: %cn", upper);
return 0;
}
Similar questions