## TCS NQT Coding Questions (21st Feb, 2021)

There were basically two TCS NQT Coding Questions on Feb 21st, 2021. One of them asked to find the area of the circle and the other had to do with alteration in the input String. We will discuss the solution of the questions below.

# Question 1.

Given an input string, you have to encrypt the string in such a manner that ‘a’ becomes ‘z’, ‘z’ becomes ‘a’ and accordingly.

### Input format

The input is a lower case string

### Output format

Encrypted lower case string

### Example

Input:
programming

Output:
kiltiznnrmt


## Solution

Language – C++

#include<iostream>
using namespace std;
int main() {
string s, news=””;
cin>>s;
int len=s.length(); //finding the length of the string
for(int i=0;i<len;i++) {
char ch=s.at(i); //gives the character at different postions
int pos=(int)ch;
if(pos>=97 && pos<=122) {
int newpos=122-(pos-97); //finding the encrypted character
char newch=(char)newpos;
news=news+newch; //concatenating the encrypted character in a new string
}
else {
news=””;
break;
}
}
cout<<news<<endl;
}

Language – Python

n = int(input())
for items in range(0,n):
l=[]
str = input()
for x in range(len(str)):
l.append(chr(122-(ord(str[x])-97)))
print(“”.join(l))

# Question 2.

Given an input integer T. For each T,  you have to accept an integer and calculate the area of the area of the circle using that integer as the radius.

Area of Circle = πr²

### Input

T determining the number of testcases. For each testcase, radius of the circle.

NOTE – The radius should be in range 20-30.

### Output

Area of circle with the radius passed as input for every testcase nearest to decimal place. If the radius is out of range, print “Radius not in range”

### Example

Input:
3221025

Output:
1520.53Radius not in range251963.49

Solution

Language – C++

#include<iostream>
using namespace std;
int main() {
int T;
cin>>T;
while(T–) {
cout<<area<<endl;
}
else
}

Language – Python

n = int(input())
for x in range(n):