answersLogoWhite

0

#include <stdio.h>

int main(int argc, char **argv)

{

if (argc<1) {

printf("Usage: %s number\n",argv[0]);

return -1;

}

int digits=1, i=atoi(argv[1]);

while (i/=10) ++digits;

printf("%d\n",digits);

}

User Avatar

Wiki User

16y ago

What else can I help you with?

Related Questions

Write a Shell program to find the sum of cube of individual digits of a number?

no thanks


How write a program to input any number and display digits which are absent in given number?

To write a program that inputs a number and displays the digits absent in it, you can follow these steps: Convert the input number into a set of its digits. Create a set of all possible digits (0-9). Subtract the set of digits from the complete set to find the missing ones. Display the missing digits. Here’s a simple example in Python: number = input(&quot;Enter a number: &quot;) present_digits = set(number) all_digits = set('0123456789') missing_digits = all_digits - present_digits print(&quot;Missing digits:&quot;, ''.join(missing_digits))


How to write A Java program to print number of digits in a given number?

One way to do this is to convert the number to a String, then use the corresponding String method to find out the length of the String.


Write a pseudo code to find the sum of digits of a given number reducing them to a single digit?

5


Shell program to find the sum of square of individual digits of a number?

There are many shell programs that will find the sum of the square of individual digits of a number. A small example is: SD=3n=2, sum=2, and SD=2.


Write a Shell program to find the smallest number from a set of numbers?

k


Write a program to find Armstrong number in visual basic 10?

An Armstrong number (or narcissistic number) for a given number of digits is a number that is equal to the sum of its own digits raised to the power of the number of digits. Here’s a simple Visual Basic 10 program that checks for Armstrong numbers: Module ArmstrongNumber Sub Main() Dim num As Integer Dim sum As Integer = 0 Console.Write(&quot;Enter a number: &quot;) num = Convert.ToInt32(Console.ReadLine()) Dim temp As Integer = num Dim digits As Integer = num.ToString().Length While temp &gt; 0 Dim digit As Integer = temp Mod 10 sum += Math.Pow(digit, digits) temp \= 10 End While If sum = num Then Console.WriteLine(num &amp; &quot; is an Armstrong number.&quot;) Else Console.WriteLine(num &amp; &quot; is not an Armstrong number.&quot;) End If End Sub End Module This program takes a number as input, calculates the sum of its digits raised to the power of the number of digits, and checks if the sum equals the original number.


Write a java program to find out the sum of a number of n digits?

class Sum_Of_Digits { public static void printSumandnoofdigits(int n) { int temp = n; int count = 0; int sum = 0; while ( n &gt; 0 ) { sum = sum + n % 10; n = n / 10; count ++; } System.out.println("The number is..." + temp ); System.out.println("The sum of digits is..." + sum); System.out.println("The number of digits is..." + count); } }


Shell program to find the sum of cube of individual digits of a number?

Shell problems are programs that can be run to find out information about numbers. The problem can help find an even or odd number, or what the sum of a cube is.


How do you write a java program to find the square root of a number?

You can use the Math.sqrt() method.


Write a Shell program to find the smallest digits of a number?

You can create a Shell script to find the smallest digit of a number by iterating through its digits. Here's a simple example: #!/bin/bash read -p &quot;Enter a number: &quot; number smallest=9 for (( i=0; i&lt;${#number}; i++ )); do digit=${number:$i:1} if (( digit &lt; smallest )); then smallest=$digit fi done echo &quot;The smallest digit is: $smallest&quot; This script prompts the user for a number, checks each digit, and prints the smallest one.


Write a c program to find given number is prime or not?

Yes, do write, or if you're too lazy to your homework, use google.