`{"id":"43f71602-fd2f-4b4a-b526-b6b82c8730e9","name":"Count Digits In A Number","description":"1. You've to count the number of digits in a number.\r\n2. Take as input \"n\", the number for which the digits has to be counted.\r\n3. Print the digits in that number.","inputFormat":"\"n\" where n is any integer.","outputFormat":"\"d\" where d is the number of digits in the number \"n\"","constraints":"1 &lt;= n &lt; 10^9","sampleCode":{"cpp":{"code":"#include <iostream>\r\nusing namespace std;\r\n\r\nint main(int argc, char **argv){\r\n int n;\r\n cin >> n;\r\n \r\n //write your code here\r\n \r\n}"},"java":{"code":"import java.util.*;\r\n \r\n public class Main{\r\n \r\n public static void main(String[] args) {\r\n // write your code here \r\n }\r\n }"},"python":{"code":"def count(n):\n # write your code here\n\ndef main():\n n = int(input())\n count(n)\n\nif __name__==\"__main__\":\n main()"}},"points":10,"difficulty":"easy","sampleInput":"65784383","sampleOutput":"8","questionVideo":"https://www.youtube.com/embed/4wtESDtEBp4","hints":[],"associated":[{"id":"3063799a-9815-4234-82c9-d5b71527bfe0","name":"choose the correct output:","slug":"choose-the-correct-output","type":4},{"id":"80351608-a3e5-474a-8241-47f6b679d67c","name":"Fill the blank in according to Counts digit problem ?","slug":"fill-the-blank-in-according-to-counts-digit-problem","type":4},{"id":"a25784e1-2fe4-43e2-b5c6-067963482324","name":"choose the correct one:","slug":"choose-the-correct-one","type":4}],"solutionSeen":false,"tags":[],"meta":{"path":[{"id":0,"name":"home"},{"id":"0c54b191-7b99-4f2c-acb3-e7f2ec748b2a","name":"Data Structures and Algorithms","slug":"data-structures-and-algorithms","type":0},{"id":"72157774-7fd0-4b8e-88dc-037800acd626","name":"Getting Started","slug":"getting-started-9996","type":0},{"id":"b3803d1e-4e6d-47d9-9268-3ef9c86c0506","name":"Count Digits In A Number","slug":"count-digits-in-a-number","type":1}],"next":{"id":"52d875fc-90c1-4488-bb06-c140452f7619","name":"Count Digits In A Number","type":3,"slug":"count-digits-in-a-number"},"prev":{"id":"9d392adf-2158-44d9-a7a8-0f9da9bc59c6","name":"Print Fibonacci Numbers Till N","type":3,"slug":"print-fibonacci-numbers-till-n"}}}`

# Count Digits In A Number

1. You've to count the number of digits in a number. 2. Take as input "n", the number for which the digits has to be counted. 3. Print the digits in that number.

`{"id":"43f71602-fd2f-4b4a-b526-b6b82c8730e9","name":"Count Digits In A Number","description":"1. You've to count the number of digits in a number.\r\n2. Take as input \"n\", the number for which the digits has to be counted.\r\n3. Print the digits in that number.","inputFormat":"\"n\" where n is any integer.","outputFormat":"\"d\" where d is the number of digits in the number \"n\"","constraints":"1 &lt;= n &lt; 10^9","sampleCode":{"cpp":{"code":"#include <iostream>\r\nusing namespace std;\r\n\r\nint main(int argc, char **argv){\r\n int n;\r\n cin >> n;\r\n \r\n //write your code here\r\n \r\n}"},"java":{"code":"import java.util.*;\r\n \r\n public class Main{\r\n \r\n public static void main(String[] args) {\r\n // write your code here \r\n }\r\n }"},"python":{"code":"def count(n):\n # write your code here\n\ndef main():\n n = int(input())\n count(n)\n\nif __name__==\"__main__\":\n main()"}},"points":10,"difficulty":"easy","sampleInput":"65784383","sampleOutput":"8","questionVideo":"https://www.youtube.com/embed/4wtESDtEBp4","hints":[],"associated":[{"id":"3063799a-9815-4234-82c9-d5b71527bfe0","name":"choose the correct output:","slug":"choose-the-correct-output","type":4},{"id":"80351608-a3e5-474a-8241-47f6b679d67c","name":"Fill the blank in according to Counts digit problem ?","slug":"fill-the-blank-in-according-to-counts-digit-problem","type":4},{"id":"a25784e1-2fe4-43e2-b5c6-067963482324","name":"choose the correct one:","slug":"choose-the-correct-one","type":4}],"solutionSeen":false,"tags":[],"meta":{"path":[{"id":0,"name":"home"},{"id":"0c54b191-7b99-4f2c-acb3-e7f2ec748b2a","name":"Data Structures and Algorithms","slug":"data-structures-and-algorithms","type":0},{"id":"72157774-7fd0-4b8e-88dc-037800acd626","name":"Getting Started","slug":"getting-started-9996","type":0},{"id":"b3803d1e-4e6d-47d9-9268-3ef9c86c0506","name":"Count Digits In A Number","slug":"count-digits-in-a-number","type":1}],"next":{"id":"52d875fc-90c1-4488-bb06-c140452f7619","name":"Count Digits In A Number","type":3,"slug":"count-digits-in-a-number"},"prev":{"id":"9d392adf-2158-44d9-a7a8-0f9da9bc59c6","name":"Print Fibonacci Numbers Till N","type":3,"slug":"print-fibonacci-numbers-till-n"}}}`

Editor

# Count Digits In A Number

easy

1. You've to count the number of digits in a number. 2. Take as input "n", the number for which the digits has to be counted. 3. Print the digits in that number.

1 <= n < 10^9

## Format

### Input

"n" where n is any integer.

### Output

"d" where d is the number of digits in the number "n"

## Example

Sample Input

`.css-23h8hz{color:inherit;font-size:0.875rem;line-height:1.125rem;letter-spacing:0.016rem;font-weight:var(--chakra-fontWeights-normal);white-space:pre-wrap;}65784383`

### Sample Output

`.css-3oaykw{color:var(--chakra-colors-active-primary);font-size:0.875rem;line-height:1.125rem;letter-spacing:0.016rem;font-weight:var(--chakra-fontWeights-normal);white-space:pre-wrap;font-family:Monospace;}8`

Question Video

Discussions

Show Discussion

Related Resources