-
Recent Posts
Recent Comments
Archives
Categories
Meta
Tag Archives: #WSQ11
#TC1017 #WSQ11 #yosoy196
Comments Off on #TC1017 #WSQ11 #yosoy196
Posted in Blogs, Syndicated, TC1017 Blogs
I’m done #TC1017
I'm done #TC1017
Hola aqui les presento mi #WSQ11 https:/
Esta my difficult.
Saludos.
WSQ11 – YoSoy196
Hey everybody!!
This time we wrote a great code. it’s the longest code I’ve written: 98 code lines!!
Here is the link tho the code:
https:/
Enjoy it!!
#WSQ11
This program seen here uses fuctions in a fun way to determine weather a number is a palindrome or not.
in this program the number will count as a palindrome if it can become a palindrome, example:
11 = palindrome
31= (31+13=44) =palindrome
28=(28+82=110)=(110+011=121)=palindrome
The only way that a number will be considered a non palindrome by this program is if it takes +30 steps to turn into a palindrome.
Comments Off on #WSQ11
Posted in Blogs, Syndicated, TC1014 Blogs
Tagged #TC1014, #WSQ11, ken'sCourse, WSQs
#WSQ11
This program seen here uses fuctions in a fun way to determine weather a number is a palindrome or not.
in this program the number will count as a palindrome if it can become a palindrome, example:
11 = palindrome
31= (31+13=44) =palindrome
28=(28+82=110)=(110+011=121)=palindrome
The only way that a number will be considered a non palindrome by this program is if it takes +30 steps to turn into a palindrome.
Comments Off on #WSQ11
Posted in Blogs, Syndicated, TC1014 Blogs
Tagged #TC1014, #WSQ11, ken'sCourse, WSQs
#WSQ11
This program seen here uses fuctions in a fun way to determine weather a number is a palindrome or not.
in this program the number will count as a palindrome if it can become a palindrome, example:
11 = palindrome
31= (31+13=44) =palindrome
28=(28+82=110)=(110+011=121)=palindrome
The only way that a number will be considered a non palindrome by this program is if it takes +30 steps to turn into a palindrome.
Comments Off on #WSQ11
Posted in Blogs, Syndicated, TC1014 Blogs
Tagged #TC1014, #WSQ11, ken'sCourse, WSQs
Yo soy 196
In this wsq I create a program that ask por the user for a lower bound and the upper bound, so the program will print the number of natural palindromes, non-lychrel numbers and lychrel candidates contained in the range pf that numbers.
I also create a function to see if the numbers are palindromo natural number.
At the end the program will print which numbers are lychrel numbers, of course that in this programa just can see the categories fo that number in 30 iteration at maximun.
so here is my code: https:/
this will help: http:/
WSQ11
#WSQ11 #IAM196 #PALINDROMES #SEMORDNILAP #123 #321 #<—-notpalindrome
This program was created for the user to give a value and see if it is a palindrome or not.
the program first asks for a number entered by the user, after this, we called a function that converts the integer to a string value. After that, we invert the string so the number looks backwards and we convert it to “int” again. After this new int is created, we compare the original one with the new one (which is backwards) and see if they are the same. If they are indeed de same, then we tell the program to print a message that sais “the number is a palindrome”. To make it look even better, we asked the user for two numbers and then we printed the ones that were palindromes using the first steps, if it wasn’t a palindrome, then we asked the user if he wanted to see if it could be transformed to palindrome. To do this, we created another function that inverts the integer and adds it to its original, (in order to create the new palindrome) and we printed it to the user. If not even like that was the number able to transform into a palindrome, then we printed a message that said it couldn’t be transformed.
here is the code with notes to be understanded:
#include <iostream>
#include <sstream>
#include <stdio.h>
#include “string.h”
#include <algorithm>
using namespace std;
int main (){
int a, b, range, pal;
string answer;
int counter = 0;
cout <<“please enter a value “;
cin >> (a);
cout <<“please enter the upper value”<<endl;
cin >> (b);
range = (b-a);//range of numbers between the ones given by the user
cout <<“the range of the numbers given is “<< range <<” n”;
for (int i=a; i<=b; i++) {
ostringstream ostr; //output string stream
ostr << i; //use the string stream just like cout,
//except the stream prints not to stdout but to a string.
std::string textnumber = ostr.str();
string textnumber2 = textnumber;
reverse(textnumber.begin(),textnumber.end());
if (textnumber == textnumber2){
cout <<” this number is a palindrome!n”<<textnumber<<endl;
}else {
cout <<“this number isnt a natural palindrome! n”<<textnumber2<<endl;
//here is where the rest of the code needs to go
string str = textnumber;
std::stringstream s_str( str );//converts string to int value
int r;//new int value asigned for str
s_str >> r;//gives r the value of str in int
int newpalindrome =(r + i);// sums the original digit with its inverse
cout <<” “<<newpalindrome << ” “;
for (int i=a; i<=b; i++) {
ostringstream ostr; //output string stream
ostr << newpalindrome; //use the string stream just like cout,
//except the stream prints not to stdout but to a string.
std::string newpalindrome1 = ostr.str();//creates the string variable that will include the value
// of “newpalindrome”
string newpalindrome2 = newpalindrome1;// saves the original text to be able to compare both
reverse(newpalindrome1.begin(),newpalindrome1.end());
if (newpalindrome1 == newpalindrome2){
cout <<” this number became a palindrome due to the sum of the original nonpalindrome with its inverse!n”<<newpalindrome1<<endl;
}
else {
cout <<“sorry, this number is a natural lycherel”<<newpalindrome1 <<endl;
}
counter = counter + 1;
}while (counter < 1);
}
}
return 0;
}
Comments Off on WSQ11
Posted in Blogs, Syndicated, TC1017 Blogs
Tagged #123, #321, #IAM196, #include, #PALINDROMES, #SEMORDNILAP, #WSQ11
WSQ11. Yo soy 196
In this assignment I had to create a program where the user had to enter a sequence of numbers by giving the lower and upper bounds, then the program had to print the number of natural palindromes, non-lychrel numbers and lychrel candidates contained in the sequecence.
In order to accomplish this task, I created a list where each of the numbers was allowed and then, I used a for loop to go over each of these numbes and check to which category they belonged by using a bunch of control flow tools (if, else) and a function that I defined at the begginning used to check if it was a natural palindrome number or not.
Also I added an extra list to allow lychrel numbers and then print them at the end.
You can check my code here: https:/