Write a program that tests integers to see if they are special. A special integer is one in which all of the digits have the same value. The program should allow testing as many values as the user wishes. You should use the % operator (called “mod”) which, if both operands are non-negative integers, gives the remainder of an integer division. Thus, for example, 1357%10 is 7 (the rightmost digit of the number). Also note that the / operator, if both operands are non-negative integers, will give all digits except the rightmost digit: 1357/10 is 135. You can use these two operators and a loo
can someone help me do this its for an intro class, its in C ++
i cant use a list
Think about it this way: Input: An integer (base 10) called num Output: A boolean value. Local variables: integer bin, integer i. i := 0 bin = num%10 Loop: While num != 0 do: i = num%10 if i != bin then return false num = num/10 End Loop Return true In C code, one way to code it would be: http://codepad.org/a4Jwx6h7
Join our real-time social learning platform and learn together with your friends!