Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

how to convert given number to corresponding string

+3 votes
asked Jul 12, 2019 by Bala

1 Answer

+2 votes
answered Jul 12, 2019 by Loki (1,600 points)
Don't know which language you ask for

For C: use itoa() function

         e.g. int x = 10;

                 char y[5];

                 itoa(x, y, 10);

                here 10 in itoa() is the base of number used, the base can be hexadecimal, binary etc.

For Java: There are many ways two main functions used are Integer.toString() and String.valueOf()

                 e.g. int a = 20;

                        String b = Integer.toString(a);

                      //String b = String.valueOf(a);

For Python: just use the str() function

                   e.g. int x = 10;

                           print("Hello"+ str(x) + "world");
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...