#include&lt;stdio.h&gt; #include&lt;math.h&gt;  int main() {     int n, num, sum=0, count=0, a, remain=0;     printf(&quot;Enter a number : &quot;);     scanf(&quot;%d&quot;, &amp;num);     a=num;     n=num;      while(a!=0)     {         a=a/10;         count++;     }      while(n!=0)     {         remain=n%10;         sum=sum+pow(remain, count);         printf(&quot;%d\n&quot;, sum);         n=n/10;     }      if(sum==num)         printf(&quot;Armstrong Number&quot;);     else         printf(&quot;Not an Armstrong Number&quot;);      return 0; }  guys I am trying to make a program of checking if a number is Armstrong number or not. And I am facing this problem with '153' as an input specifically. The program works fine with various inputs but compiler is showing unusual behavior while adding 153. I will also attach the output with different inputs explicitly showing the addition of numbers in the 'sum' variable. OUTPUT: Enter a number : 153 27 151 152 Not an Armstrong Number  Enter a number : 371 1 344 371 Armstrong Number
27
Consider the following code:   0.1 + 0.2 == 0.3  -&gt;  false   0.1 + 0.2         -&gt;  0.30000000000000004   Why do these inaccuracies happen?
13053
Why do most C programmers name variables like this:  int *myVariable;   rather than like this:  int* myVariable;   Both are valid. It seems to me that the asterisk is a part of the type, not a part of the variable name. Can anyone explain this logic?
52592
I need my formula to increase by "1" for every "25".  I wrote the following formula, but it does not work:  =SUM( IF(O11&lt;25,0, IF(O11&lt;50&gt;21,1, IF(O11&lt;75&gt;51,2, IF(O11&lt;100&gt;76,3, IF(O11&lt;125&gt;101,4))))))
102686
I tried this and that, but could not solve this problem. Here is the code that produces this error:  \begin{equation} o=g(h)=\left\{\begin{array}{rcl}     1 &amp; if &amp; h &lt;   0 \\     0 &amp; if &amp; h \le 0  \end{array}\right \end{equation}   The error is given on the line \end{equation} resides. Thanks.
106074
Why doesn't Java include support for unsigned integers?    It seems to me to be an odd omission, given that they allow one to write code that is less likely to produce overflows on unexpectedly large input.    Furthermore, using unsigned integers can be a form of self-documentation, since they indicate that the value which the unsigned int was intended to hold is never supposed to be negative.    Lastly, in some cases, unsigned integers can be more efficient for certain operations, such as division.    What's the downside to including these?
96257
In C, are the shift operators (&lt;&lt;, &gt;&gt;) arithmetic or logical?
26696
In Program 1 Hello world gets printed just once, but when I remove  \n and run it (Program 2), the output gets printed 8 times. Can someone please explain me the significance of \n here and how it affects the fork()?  Program 1   #include &lt;sys/types.h&gt; #include &lt;unistd.h&gt; #include &lt;stdio.h&gt; #include &lt;stdlib.h&gt;  int main() {     printf("hello world...\n");     fork();     fork();     fork(); }   Output 1:  hello world...    Program  2  #include &lt;sys/types.h&gt; #include &lt;unistd.h&gt; #include &lt;stdio.h&gt; #include &lt;stdlib.h&gt;  int main() {     printf("hello world...");     fork();     fork();     fork(); }   Output 2:  hello world... hello world...hello world...hello world...hello world...hello world...hello world...hello world...
26520
I am not looking for an answer on this. Just need to clarify why my approach is failing -  $N_1 + N_2 + N_3$, i.e. single digit, double digit, 3 digit  single $= 2, 4, 6, 8$, i.e 4   double = X non-zero $= 8 \cdot 4 = 32$ X zero $= 9 \cdot 1 = 9$  Now the confusing part three digit, breaking into 4 cases   X zero zero $= 9$   X nz nz $= 7 \cdot 8 \cdot 4 = 224$   X z nz $= 8 \cdot 1 \cdot 4 = 32$   X nz z $= 8 \cdot 9 \cdot 1 = 72$  Three digit total comes to $= 9 + 224 + 32 + 72 = 337$. This answer is wrong and it should be $328$. What am I missing in the logic? Please suggest.
9685
I had originally coded the program wrongly. Instead of returning the Fibonacci numbers between a range (ie. startNumber 1, endNumber 20 should = only those numbers between 1 &amp; 20), I have written for the program to display all Fibonacci numbers between a range (ie. startNumber 1, endNumber 20 displays = First 20 Fibonacci numbers). I thought I had a sure-fire code. I also do not see why this is happening.  startNumber = int(raw_input("Enter the start number here ")) endNumber = int(raw_input("Enter the end number here "))  def fib(n):     if n &lt; 2:         return n     return fib(n-2) + fib(n-1)  print map(fib, range(startNumber, endNumber))   Someone pointed out in my Part II (which was closed for being a duplicate - ) that I need to pass the startNumber and endNumber through a generator using a while loop. Can someone please point me in the direction on how to do this? Any help is welcome.    I'm a learning programmer and I've run into a bit of a jumble. I am asked to write a program that will compute and display Fibonacci's Sequence by a user inputted start number and end number (ie. startNumber = 20 endNumber = 100 and it will display only the numbers between that range). The trick is to use it inclusively (which I do not know how to do in Python? - I'm assuming this means to use an inclusive range?).  What I have so far is no actual coding but rather:   Write Fib sequence formula to infinite Display startNumber to endNumber only from Fib sequence.   I have no idea where to start and I am asking for ideas or insight into how to write this. I also have tried to write the Fib sequence forumla but I get lost on that as well.
50035
I am trying to learn more about macro programming - if that's the right word - in TeX and LaTeX.  I began by defining a quantity I called Sum : \newcount\Sum.  I then wrote \Sum=0.  Then I did some arithmetical operations on Sum, by using \multiply . . . by . . .  and \advance . . . by . . ..   Finally I wanted to print out (in the document) the value of Sum. For that I used the line    The Sum equals **\number**\Sum ,    and it worked as expected !  But later on, I discovered that I might just as well have written   The Sum equals **\the**\Sum ".    And now I wonder which of the two is the preferred way to write out a numerical value.  Are they equivalent ?  Or are they intended for different purposes - even if the results overlap in my example ?   Here is an MWE:  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% %% Here is the example tex-file that illustrates use of \number and \the .    %%                                            %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%         \documentclass{article} \usepackage[paperwidth=4in, paperheight=0.8in]{geometry}  \begin{document}  \newcount\a  \newcount\b  \newcount\Sum  \a=1   \b=5  \Sum=0 \advance\Sum by \a  \multiply\Sum by \b \advance\Sum by \a  \multiply\Sum by \b  \noindent The Sum equals \number\Sum  \quad;\quad I used ``number''. \par \vskip 10pt \noindent The Sum equals \the\Sum     \quad;\quad I used ``the''.  \end{document}
59637
This seems like a simple question, but I can't find it with the Stack Overflow search or Google. What does a type followed by a _t mean? Such as  int_t anInt;   I see it a lot in C code meant to deal closely with hardware—I can't help but think that they're related.
1679
What does the , operator do in C?
71656
\documentclass{article} \usepackage{amsmath} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \begin{document}     \begin{align}         \hat{\alpha} &amp;= \begin{cases}                       \tan^{-1}\frac{\hat{\alpha_1}}{\hat{\alpha_2}},  \,    &amp;\text{if }  \hat{\alpha_1}&gt;0 \, \hat{\alpha_2}&gt;0 \\                      \tan^{-1}\frac{\hat{\alpha_1}}{\hat{\alpha_2}}+\pi,  \,  &amp;\text{if }  \hat{\alpha_1}&lt;0 \\                      \tan^{-1}\frac{\hat{\alpha_1}}{\hat{\alpha_2}}+2\pi,   \, &amp;\text{if  }\hat{\alpha_2}&lt;0 \,  \hat{\alpha_1} &gt;0 \\                      \text{undefined}, &amp; \hat{\alpha_2}=0 \, \hat{\alpha_1}=0                 \end{cases}      \end{align}  \end{document}   I need to numbering of this cases but when i put align code , the file not compiling because \par .... what is wrong please help me i attempt every probability to solve this
37655
In Bash, two integers can be compared using conditional expression     arg1 OP arg2      OP is one of -eq, -ne, -lt, -le, -gt, or -ge. These   arithmetic binary operators return true if arg1 is equal to, not equal   to, less than, less than or equal to, greater than, or greater than or   equal to arg2, respectively. Arg1 and arg2 may be positive or negative   integers.   or arithmetic expression:     &lt;= &gt;= &lt; &gt; comparison      == != equality and inequality   Why do we have two different ways for comparing two integers? When to use which?  For example, [[ 3 -lt 2 ]] uses conditional expression, and (( 3 &lt; 2 )) uses arithmetic expression. Both returns 0 when the comparison is true  When comparing two integers, can these two methods always be used interchangeably? If yes, why does Bash have two methods rather than one?
40771
I know that I should use the definition of an odd integer ($2k+1$), but that's about it.  Thanks in advance!
13470
I am a little surprised by the following.  Example 1:  char s[100] = "abcd"; // declare and initialize - WORKS   Example 2:  char s[100]; // declare s = "hello"; // initalize - DOESN'T WORK ('lvalue required' error)   I'm wondering why the second approach doesn't work. It seems natural that it should (it works with other data types)? Could someone explain me the logic behind this?
113604
I was messing around with my TI-84 Plus Silver Edition calculator and discovered that it will actually give me values when taking the factorial of any number $n/2$ where $n$ is any integer greater than $-2$. Why does this happen? I thought factorials were only defined for positive integers and $0$, so what is my calculator doing to get the answer $3.32335097$ when I enter $2.5!$? Is there actually a definition of $2.5!$ or is my calculator just being weird? How is the factorial function implemented?  I understand the binary implications of $2.5$, so that could possibly have something to do with it. I get a domain error when trying to take the factorial of $-1, 2.3, e$, and any number that is not of the form $n/2$ where $n$ is any integer greater than $-2$.