ans="" for i in s: res=ord(i)+key if res>90: ans+=chr(res-26) elif res>122: ans+=chr(res-26) elif i.isnumeric(): k=int(i)-10+key ans+=str(k) print(ans)
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String s = sc.nextLine(); int key = sc.nextInt(); StringBuilder result = new StringBuilder(); for (int i = 0; i < s.length(); i++) { char ch = s.charAt(i); if (ch >= 'A' && ch = 'a' && ch
please tell me is this code wrong and why #include using namespace std; int main() { string c; cin >> c; cout key; for(int i = 0 ; i < c.length();i++){ //add key to each character c[i] = c[i] + key; } cout
ans=""
for i in s:
res=ord(i)+key
if res>90:
ans+=chr(res-26)
elif res>122:
ans+=chr(res-26)
elif i.isnumeric():
k=int(i)-10+key
ans+=str(k)
print(ans)
I think checking must be done in ascend order of asc values
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String s = sc.nextLine();
int key = sc.nextInt();
StringBuilder result = new StringBuilder();
for (int i = 0; i < s.length(); i++) {
char ch = s.charAt(i);
if (ch >= 'A' && ch = 'a' && ch
very good explanation sir
your content is really helpful sir,can we expect these kind of questions in tcs nqt advance coding exam .sir plz reply
Yessss
sir is it possible use map in tcs nqt exam?
is it a advanced question or an easy question in the exam?
please tell me is this code wrong and why
#include
using namespace std;
int main()
{
string c;
cin >> c;
cout key;
for(int i = 0 ; i < c.length();i++){
//add key to each character
c[i] = c[i] + key;
}
cout
If char is z and we add +1 to it , it will not become a in your code
#include
using namespace std;
int main() {
string s ="yZ89";
string ans="";
int k=2;
k=k%26;
for(int i=0; i=65 && s[i]
Hindi m bta diya kr bhaii
python code
for char in s:
if char.isalpha():
if char.islower():
new_char = chr((ord(char) - ord('a') + key) % 26 + ord('a'))
else:
new_char = chr((ord(char) - ord('A') + key) % 26 + ord('A'))
result.append(new_char)
elif char.isdigit():
new_char = str((int(char) + key) % 10)
result.append(new_char)
else:
result.append(char)
import java.util.*;
import java.lang.*;
class Item{
public static void main(String[] args){
Scanner ask=new Scanner(System.in);
String r=ask.next();
String h="";
int key=ask.nextInt();
for(int i=0;i=10){
t=t-10;
}
h=h+t;
}
else{
int e=r.charAt(i)+key;
if(r.charAt(i)>=97&& r.charAt(i)122){h=h+ (char)(r.charAt(i)+key-26);}
}
else if(r.charAt(i)>=65 && r.charAt(i)90){
h=h+ (char)(r.charAt(i)+key-26);
}
}
else{
h=h+ (char)(r.charAt(i)+key);
}
}
}
System.out.println(h);
}
}
Bhai ye coding round kisse online platform pe hota hai ya fir any compiler.? & Hume sirf logic likhne hote hai na .?
package java_pratice;
import java.util.*;
public class hello {
public static void main(String[] args){
Scanner in = new Scanner(System.in);
String str = in.nextLine();
int key = in.nextInt();
String newstr ="";
for(int i=0;i 9) {
num -= 10;
}
newstr += num;
}
else if(Character.isLetter(str.charAt(i))) {
int num = str.charAt(i);
num += key;
if(num > 90 && Character.isUpperCase(str.charAt(i))) {
num -= 26;
}else if(num > 122 && Character.isLowerCase(str.charAt(i))){
num -= 26;
}
char ch = (char)num;
newstr += Character.toString(ch);
}
}
System.out.println(newstr);
}
}
Hello Bhai ye coding round kisse online platform pe hota hai ya fir any compiler.? & Hume sirf logic likhne hote hai na .?
@@Aman-dh9wz no bro full from scratch with input