{"id":8599,"date":"2021-09-30T10:30:21","date_gmt":"2021-09-30T05:00:21","guid":{"rendered":"https:\/\/python-programs.com\/?p=8599"},"modified":"2021-11-22T18:39:24","modified_gmt":"2021-11-22T13:09:24","slug":"program-to-read-a-number-n-and-compute-n-nn-nnn-in-cpp-and-python","status":"publish","type":"post","link":"https:\/\/python-programs.com\/program-to-read-a-number-n-and-compute-n-nn-nnn-in-cpp-and-python\/","title":{"rendered":"Program to Read a Number n and Compute n+nn+nnn in C++ and Python"},"content":{"rendered":"

In the previous article, we have discussed about Program to Clear the Rightmost Set Bit of a Number in C++ and Python<\/a>. Let us learn Program to Read a Number n and Compute n+nn+nnn in C++ Program and Python.<\/p>\n

Given a number n , the task is to calculate the value of n+ nn +nnn in C++ and Python.<\/p>\n

Examples:<\/strong><\/p>\n

Example1:<\/strong><\/p>\n

Input:<\/strong><\/p>\n

given number = 8<\/pre>\n

Output:<\/strong><\/p>\n

The value of 8 + 88 + 888 = 984<\/pre>\n

Example2:<\/strong><\/p>\n

Input:<\/strong><\/p>\n

given number = 4<\/pre>\n

Output:<\/strong><\/p>\n

Enter any random number = 4\r\nThe value of 4 + 44 + 444 = 492<\/pre>\n

Example3:<\/strong><\/p>\n

Input:<\/strong><\/p>\n

given number = 9<\/pre>\n

Output:<\/strong><\/p>\n

The value of 9 + 99 + 999 = 1107<\/pre>\n

Program to Read a Number n and Compute n+nn+nnn in C++ and Python<\/h2>\n

Our website provided core java programs examples with output<\/a> aid beginners and expert coders to test their knowledge gap and learn accordingly.<\/p>\n

There are several ways to calculate the value of n + nn + nnn in C++ and\u00a0 python some of them are:<\/p>\n