def base17_decimal(num): dict1 = {'a': 10, 'b': 11, 'c': 12, 'd': 13, 'e': 14, 'f': 15, 'g': 16} num = num.lower() res = 0 for i, digit in enumerate(reversed(num)): if digit.isdigit(): decimal_digit = int(digit) else: decimal_digit = dict1[digit] res += decimal_digit * (17 ** i) return res
@shreyaghosh148911 ай бұрын
Solution for 2nd question in python st=input() d={'A':10,'B':11,'C':12,'D':13,'E':14,'F':15,'G':16} i=len(st)-1 s=0 p=0 while(i>=0): if st[i].isdigit(): s=s+int(st[i])*(pow(17,p)) else: s=s+(d[st[i]]*pow(17,p)) i=i-1 p=p+1 print(s)
@MuthuAnushya11 ай бұрын
Hello sir the first problem is geekforgeeks problem sir today i saw that and try to solve sum of subarray awesome explanation sir..
@PrepInsta11 ай бұрын
Hey there❤️, Kindly message us at 8448440710 Whatsapp number, our mentors will guide you further precisely with the details.
@taufiqattar175611 ай бұрын
@@PrepInstayou replied all comments but not on my comment of solution code 😂
@anyanu747511 ай бұрын
#include using namespace std; int main(){ string t; cin>>t; int power=0, val=0, temp=0; for(int i=t.size()-1; i>=0; i--){ if(t[i]-'0' < 10) temp = t[i]-'0'; else temp = t[i]-'A'+10; val += temp*pow(17, power); power++; } cout
@prasannakumari-d2t11 ай бұрын
Hi sir..nice explanation sir.. please do more coding questions videos for tcs nqt preparation sir..
@PrepInsta11 ай бұрын
Thanks for commenting❤️, Sure we will be coming up with more videos like this, till then kindly refer this link prepinsta.com/tcs-nqt/placement-papers/
@roushankumar225011 ай бұрын
Can u share the WhatsApp group link for 24 batch as the link given in the description doesn't work @@PrepInsta
@jessyjasmitha566611 ай бұрын
CODE IN PYTHON def base17_to_decimal(input_str): base17_digits = '0123456789ABCDEFG' input_str = input_str[::-1] # Reverse the input string for easier processing decimal_value = 0 for i in range(len(input_str)): decimal_value += base17_digits.index(input_str[i]) * (17 ** i) return decimal_value # Test cases input_1 = input() output_1 = base17_to_decimal(input_1) print(f"Case 1 - Input: {input_1}, Output: {output_1}") input_2 = input() output_2 = base17_to_decimal(input_2) print(f"Case 2 - Input: {input_2}, Output: {output_2}")
@rohankarmakar176111 ай бұрын
my approach in cpp #include using namespace std; int main() { int s=15; int arr[10]={5,3,7,14,18,1,18,4,3,8}; for(int i=0; i
@mohitdulani914410 ай бұрын
not correct approach
@dibabosuchatterjee149711 ай бұрын
The most important thing is: PYTHON COMPILER FOR TCS NQT IS NOT UPTO THE MARK. I mean it always shows compilation error. NOW IT'S YOUR CHOICE....
@264vsainagaCharitha11 ай бұрын
🥲
@orlando_kawaii10 ай бұрын
So did u do all of those in C++
@dibabosuchatterjee149710 ай бұрын
@@orlando_kawaii java
@arunchandrahalemani795111 ай бұрын
Solution for giveaway with very easy to understand code using dictionary: # creating the mapping using dictionary base17 = { '0' : 0, '1' : 1, '2' : 2, '3' : 3, '4' : 4, '5' : 5, '6' : 6, '7' : 7, '8' : 8, '9' : 9, 'A' : 10, 'B' : 11, 'C' : 12, 'D' : 13, 'E' : 14, 'F' : 15, 'G' : 16 } number = input("Enter the base 17 value: ") last_index = len(number)-1 result = 0 power = 0 while last_index >= 0: result = result + (base17[number[last_index]] * pow(17,power)) power += 1 last_index -= 1 print(result)
@gaurang7goel11 ай бұрын
C++ solution: #include #include #include using namespace std; int base17ToDecimal(const string& input) { int decimalValue = 0; int power = 0; for (int i = input.length() - 1; i >= 0; --i) { char currentChar = toupper(input[i]); int digitValue; if (isdigit(currentChar)) { digitValue = currentChar - '0'; } else { digitValue = currentChar - 'A' + 10; } decimalValue += digitValue * pow(17, power); ++power; } return decimalValue; } int main() { string input; cout > input; int result = base17ToDecimal(input); cout
@kavyametturu682711 ай бұрын
Sir... Can you please explain all the recent tcs codevita coding question solutions like solo rider, password generator,ware house, pick up service,etc...
@PrepInsta11 ай бұрын
Hey there❤️We will be soon coming with the video for this as well, till then kindly refer this link : prepinsta.com/tcs-codevita/practice-questions-with-answers/
@shivanisankar387411 ай бұрын
Giveaway answer for the code (Python) num= str(input()) print(int(num,17))
@saumyasrivastava406511 ай бұрын
I created next step portal account in 2022 and also I updated and submitted application form in October 2023, but now when I am applying for TCS NQT off campus application is submitted successfully but in Track my application date of the receiving application form is not getting updated, please provide a solution to it at earliest as my college TPO has given a time limit to fill the google form which needs to be further processed to TCS. I have also mailed regarding this to TCS several times but getting no response.
@PrepInsta11 ай бұрын
Thanks for commenting🙌, We recommend you to kindly reach out to your TPO for the details as well as stay updated to your mails and spam folder as well, TCS will guide you further with the updates as you have mailed them.
@vamsiBheemireddy11 ай бұрын
#include using namespace std; int output(int number,int c,int len) { int r=17,count=0; int val=0; val+=number*pow(r,c); return val; } int main() { string s; cin>>s; int len=s.length()-1; int result=0,out; for(int i=s.length()-1;i>=0;i--) { if(s[i]>=48&&s[i]=65&&s[i]
@058_shivammishra911 ай бұрын
Hello Prepinsta, Here is my GiveAway Question's Answer code: #include #include #include using namespace std; int heptaToDecimal(string heptaNumber) { int decimalNumber = 0; int power = 0; for (int i = heptaNumber.length() - 1; i >= 0; i--) { if (heptaNumber[i] >= '0' && heptaNumber[i] = 'A' && heptaNumber[i] heptaNumber; int decimalNumber = heptaToDecimal(heptaNumber); std::cout
@DivyanshuGiri-d5d11 ай бұрын
give away answer for the code: #include #include using namespace std; int main () { string num; cin >> num; int decimalValue = stoi (num, nullptr, 17); cout
@taufiqattar175611 ай бұрын
Answer for question in cpp #include #include #include using namespace std; int base17ToDecimal(string input) { int decimalValue = 0; int power = 0; for (int i = input.length() - 1; i >= 0; --i) { char currentChar = input[i]; int digitValue; if (isdigit(currentChar)) { digitValue = currentChar - '0'; } else { digitValue = currentChar - 'A' + 10; } decimalValue += digitValue * pow(17, power); power++; } return decimalValue; } int main() { string input; cout > input; if (input.length()
@Noobda6911 ай бұрын
#include using namespace std; int main(){ string s; cin>>s; double ans=0.0; int n=0; for(int i=s.length()-1;i>=0;i--){ if(s[i]>='0' && s[i]= 'a' && s[i]
@amanjaisani304411 ай бұрын
#include using namespace std; void todec(string s){ int n=s.size(); long long m=0,d; for(int i=n-1;i>=0;--i ){ if(s[i]>57){ d=s[i]-'A'+10; } else{ d=s[i]-48; } m+=d*pow(17,n-1-i); } couts; todec(s); } int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); solve(); return 0; }
@DivyanshuGiri-d5d11 ай бұрын
Give away answer for the code
@kunalghosh478511 ай бұрын
#include using namespace std; int main() { string s; cin>>s; int n = s.size(); unordered_map arr; for(int i=0; i
@lakshmi-n2z11 ай бұрын
Here is my answer to the given question as I am in final year of my Btech prime will be helpful hope I will get access . import java.util.Scanner; public class Coding{ public static int convertToDecimal(String input) { int decimalValue = 0; int power = 0; for (int i = input.length() - 1; i >= 0; i--) { char digit = input.charAt(i); int digitValue; if (Character.isDigit(digit)) { digitValue = digit - '0'; } else { digitValue = digit - 'A' + 10; } decimalValue += digitValue * Math.pow(17, power); power++; } return decimalValue; } public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.print("Enter a base-17 number: "); String userInput = scanner.nextLine(); int decimalResult = convertToDecimal(userInput); System.out.println("Decimal equivalent: " + decimalResult); } }
@BornToSHiNe0011 ай бұрын
class j365 { public static int multiply (int n , int value) { int ans = 1; while (n != 0) { ans = value * ans; n--; } return ans; } public static void main(String[] args) { String str = "23GF"; HashMap map = new HashMap(); map.put('A' , 10); map.put('B', 11); map.put('C',12); map.put('D',13); map.put('E',14); map.put('F',15); map.put('G',16); int n = str.length()-1; // 1 int sum = 0; for (int i=0; i
@joydevdafadar561411 ай бұрын
Giveaway Answer : Code using C++ #include #include using namespace std; int main() { string str; //Taking input from user cin >> str; int ans = 0; int power = 1; for( int i=str.length()-1; i>=0; i-- ) { char ch = str[i]; if( ch-'0' >= 0 && ch-'0' < 10 ){ // If it is a number 0-9 ans += (power*(ch-'0')); } else{ //If it is a Character A-G ans += (power*((ch-'A')+10)); } // Maintaining the power for every reverse iteration power *= 17; } //Printing The answer cout
@rishijain847211 ай бұрын
C++ CODE: #include using namespace std; long long power(int x) { long long res=1; for(int i=0;i=65 && ch>s; long long res=0; reverse(s.begin(),s.end()); for(int i=0;i
@anmolgulati818611 ай бұрын
The answer to your questions is below , can i get prepinsta prime now pls , i really need it. Thanks #include #include using namespace std; int baseToDecimal(const string& input_str, int base) { int decimal_value = 0; int power = 0; for (int i = input_str.size() - 1; i >= 0; --i) { char digit = input_str[i]; int digit_value = 0; if (isdigit(digit)) { digit_value = digit - '0'; } else if (isalpha(digit)) { digit_value = toupper(digit) - 'A' + 10; } decimal_value += digit_value * pow(base, power); ++power; } return decimal_value; } int main() { string input_str; cin>>input_str; int base = 17; int output = baseToDecimal(input_str, base); cout
@adwaitagarai392311 ай бұрын
sweet seventeen ans in c++ #include using namespace std; int main() { mapmp{ {'a',10},{'b',11}, {'c',12},{'d',13},{'e',14},{'f',15},{'g',16},{'h',17},{'i',18},{'j',19},{'k',20},{'l',21},{'m',22},{'n',23},{'o',24},{'p',25},{'q',26},{'r',27},{'s',28},{'t',29},{'u',30},{'v',31},{'w',32},{'x',33},{'y',34},{'z',35} }; string str; cout= '0' && str[j]
@RagulRagul-xb5zu15 күн бұрын
import java.util.Scanner; public class Base17ToDecimal { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.print("Enter base-17 number: "); String base17Input = scanner.nextLine(); try { int decimalValue = Integer.parseInt(base17Input, 17); System.out.println("Decimal value: " + decimalValue); } catch (NumberFormatException e) { System.out.println("Invalid base-17 input"); } scanner.close(); } }
@rachitbadoni571711 ай бұрын
// the code for giveaway question... #include using namespace std; int main() { int base=17; string s; cin>>s; unordered_mapmp; mp['A']=10; mp['B']=11; mp['C']=12; mp['D']=13; mp['E']=14; mp['F']=15; mp['G']=16; int ans=0,ctr=0; for(int i=s.size()-1;i>=0;i--) { if(mp.find(s[i])!=mp.end())//present in map { ans+=mp[s[i]]*pow(17,ctr); } else { ans+=(s[i]-'0')*pow(17,ctr); } ctr++; } cout