Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Wipro Problem 1: generate roll number
// sample input: 145279886 // sample output: 45986 #include <bits/stdc++.h> using namespace std; int main() { int n, y, ub, len; string s, res=""; cin >> n; s = to_string(n); len = s.length(); if(len & 1) {ub = len-2;} else {ub = len-1;} for(int i=0; i<=7; i+=2) { int a = s[i] - '0'; int b = s[i+1] - '0'; int max_num = max(a, b); char maxc = max_num + '0'; res += maxc; } if(len & 1) {res += s[len-1];} cout << res; return 0; y = stoi(res); cout << y; return 0; }
run
|
edit
|
history
|
help
0
ListTel
sorting using array and pointer
queue
count common elements in three sorted array without using extraspace
infix to postfix v 5.0 (with exponent support)
шаблонизированное наследование
cast operator
Boggle Game
Switch case
Rezolvare Ex 4