1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
qwelly [4]
3 years ago
12

Given a string, convert the characters of the string into opposite case,i.e. if a character is lower case than convert it into u

pper case and vice versa.
Examples:

Input : geeksForgEeks
Output : GEEKSfORGeEKS

Input : hello every one
Output : HELLO EVERY ONE
Recommended: Please try your approach on {IDE} first, before moving on to the solution.
ASCII values of alphabets: A – Z = 65 to 90, a – z = 97 to 122
Steps:

Take one string of any length and calculate its length.
Scan string character by character and keep checking the index .
If character in a index is in lower case, then subtract 32 to convert it in upper case, else add 32 to convert it in upper case
Print the final string.
Computers and Technology
1 answer:
o-na [289]3 years ago
8 0

Answer:

// CPP program to Convert characters  

// of a string to opposite case  

#include<iostream>  

using namespace std;  

// Function to convert characters  

// of a string to opposite case  

void convertOpposite(string &str)  

{  

int ln = str.length();  

 

// Conversion according to ASCII values  

for (int i=0; i<ln; i++)  

{  

 if (str[i]>='a' && str[i]<='z')  

 //Convert lowercase to uppercase  

  str[i] = str[i] - 32;  

 else if(str[i]>='A' && str[i]<='Z')  

 //Convert uppercase to lowercase  

  str[i] = str[i] + 32;  

}  

}  

// Driver function  

int main()  

{  

string str = "GeEkSfOrGeEkS";  

 

// Calling the Function  

convertOpposite(str);  

 

cout << str;  

return 0;  

}  

Explanation:

You might be interested in
Victor has been murdered, and Art, Bob, and Carl are suspects. Art says he did not do it. He says that Bob was the victim's frie
-BARSIC- [3]

Answer:

Bob

Explanation:

we can use symbolic reasoning to prove that Bob is not innocent without enumerating all of the cases.

6 0
3 years ago
In Java how do you print ASCII values?
liubo4ka [24]
What are the choices

5 0
3 years ago
Read 2 more answers
Which is the best book for C,C++,C# and objective C??
Korvikt [17]

Answer:

Head First books

Explanation:

My professor recommended them for basically any language. I ordered one for C off amazon and I love it. It's funny, interesting and educational all at once. Would recommend 10/10.

3 0
3 years ago
If a filesystem has a block size of 4096 bytes, this means that a file comprised of only one byte will still use 4096 bytes of s
mars1129 [50]

Answer:

def calculate_storage(filesize):

   block_size = 4096

   full_blocks = filesize // block_size

   partial_block = filesize % block_size

   if partial_block > 0:

       return (full_blocks + 1) * block_size

   return filesize

print(calculate_storage(1))

print(calculate_storage(4096))

print(calculate_storage(4097))

Explanation:

The python program defines the function 'calculate_storage' that calculates the block storage used. It gets the number of blocks used to store the data by making a floor division to get the integer value, then it checks for remaining spaces in the block. If there are spaces left, it adds one to the full_blocks variable and returns the result of the multiplication of the full_blocks and block_size variables.

8 0
3 years ago
(10101) 2 = ( ? ) 10
expeople1 [14]

\huge\bigstar\:\Huge\tt\underline\blue{ANSWER}

(10101)_2=(21)10

\huge\bigstar\:\Huge\tt\underline\red{EXPLAINATION}

Given : Number  (10101)_2(10101)2

To find : What is the value of  (10101)_2(10101)2 in decimal number system?

Solution :

Decimal number system is a positional numeral system employing 10 as the base.

Now, to convert it into base 10

Multiply each digit of the following binary by the corresponding power of 2:

(10101)_2(10101)2

=1\times 2^4+0\times 2^3+1\times 2^2+0\times 2^1+1\times 2^0=1×24+0×23+1×22+0×21+1×20

=1\times 16+0\times 8+1\times 4+0\times 2+1\times 1=1×16+0×8+1×4+0×2+1×1

=16+0+4+0+1=16+0+4+0+1

=21=21

Therefore,  (10101)_2=(21)_{10}(10101)2=(21)10

5 0
3 years ago
Other questions:
  • Stores of data that are so vast that conventional database management systems cannot handle them, and very sophisticated analysi
    6·1 answer
  • 100 students were asked to fill out a form with three survey questions, as follows: H: Honor Roll C: Club membership (Robotics C
    7·1 answer
  • A _______ file is a type of vector graphics file created specifically for Windows.
    13·2 answers
  • Write a Python program that creates a dictionary containing course numbers and the room numbers of the rooms where the course me
    7·1 answer
  • ¿Qué es el comercio electrónico?
    12·1 answer
  • Which of the following is true for an API?
    6·1 answer
  • Match each career to its various job roles. digital media coordinator digital media specialist photographer sound producer creat
    13·1 answer
  • which scheduling algorithm allocate the CPU firt to the process that request the CPU first, (a) first come first serve,(b) short
    9·1 answer
  • JKJKNJJNJJJLKN;K;L;LHNL;BJ
    5·2 answers
  • Listed three functions tht are ysed in a spreadsheet​
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!