+ 1
No numerals test 3 failed
I don't know why, but the "No Numerals" code coach solution is not working https://code.sololearn.com/cZpcMMsrl242/?ref=app
5 Antworten
+ 6
Sarthak 🇳🇵 I edited your code little bit and now it works
https://code.sololearn.com/cg6cNDodsRC7/?ref=app
+ 8
Input: 1 2 3 4 5 6 7 8 9 10
Output: one two three four five six seven eight nine onezero
+ 3
hey this is how its solved
f=input()
ften=f.replace("10","ten")
f1=ften.replace("1","one")
f2=f1.replace("2","two")
f3=f2.replace("3","three")
f4=f3.replace("4","four")
f5=f4.replace("5","five")
f6=f5.replace("6","six")
f7=f6.replace("7","seven")
f8=f7.replace("8","eight")
f9=f8.replace("9","nine")
f0=f9.replace("0","zero")
print(f0)
+ 2
C++ program of No Numerals
#include<iostream>
#include<string>
using namespace std;
int main(){
string s;
getline(cin,s);
for(int i=0;i<s.length();i++){
char c=s[i];
if(s[i]=='1'&&s[i+1]=='0'){ s.replace(i,2,"ten"); }
else if(c=='0'){ s.replace(i,1,"zero"); }
else if(c=='1'){ s.replace(i,1,"one"); }
else if(c=='2'){ s.replace(i,1,"two"); }
else if(c=='3'){ s.replace(i,1,"three"); }
else if(c=='4'){ s.replace(i,1,"four"); }
else if(c=='5'){ s.replace(i,1,"five"); }
else if(c=='6'){ s.replace(i,1,"six"); }
else if(c=='7'){ s.replace(i,1,"seven"); }
else if(c=='8'){ s.replace(i,1,"eight"); }
else if(c=='9'){ s.replace(i,1,"nine"); }
}
cout<<s;
return 0;
}
+ 1
Use that, may help u
https://code.sololearn.com/cacv0SoixbJR/?ref=app