answersLogoWhite

0

Feed? What do you mean by that

User Avatar

Wiki User

13y ago

What else can I help you with?

Related Questions

How do you calculate the number of digits in an integer value using c programme?

#include <math.h> inline unsigned int get_num_digits(const unsigned int n) { return ((unsigned int) log10(n) + 1); }


What are the qualifiers that an int can have at a time?

A signed int can take a value between -32768 to 32767 and an unsigned int can take a value 0 to 65535.


2's complement of a binary number in c language?

/* note that neither of these functions have been tested, so there may be typos and the like *//* if you're looking to return a real value: */unsigned int complement(unsigned int value){unsigned int returnvalue = 0;while(value){returnvalue = 1;}return returnvalue;}/* if you're looking for a string representing the binary number: */char *complement(unsigned int value){int numchars = 8 * sizeof(unsigned int);int n;char *returnvalue = malloc((numchars + 1) * sizeof(char));for(n = 0; n < numchars; n++){if(value & (1


What is the difference between unsigned and int?

The value range. Example for 16-bit integers: signed: -32768..32767 unsigned: 0..65535


What are the four integral types in C plus plus?

There are far more than 4 integral types in C++. As of C++11, there were 27 integral types: bool char signed char unsigned char wchar_t char16_t char32_t short signed short unsigned short short int signed short int unsigned short int int signed int unsigned int long signed long unsigned long long int signed long int unsigned long int long long signed long long unsigned long long long long int signed long long int unsigned long long int


How do you generate Armstrong series in c plus plus?

#include &lt;iostream&gt; #include &lt;math.h&gt; // for std::pow() unsigned int get_length(unsigned int num,const unsigned int base=10) { unsigned int len=1; while(num &amp;&amp; (num/=base)) ++len; return( len ); } bool is_armstrong(const unsigned int num,const unsigned int base=10) { unsigned int len=get_length(num,base); unsigned int sum=0; unsigned int tmp=num; while(tmp) { sum+=(unsigned int)std::pow((double)(tmp%base),(double)len); tmp/=base; } return(num==sum); } int main() { std::cout &lt;&lt; "Armstrong series (base 10):"; for(unsigned int num=0; num&lt;=0xffffffff; ++num) if(is_armstrong(num)) std::cout &lt;&lt; " " &lt;&lt; num; std::cout &lt;&lt; std::endl; return(0); }


What is programme in c plus plus of a Armstrong number?

#include &lt;iostream&gt; #include &lt;math.h&gt; // for std::pow() unsigned int get_length(unsigned int num,const unsigned int base=10) { unsigned int len=1; while(num &amp;&amp; (num/=base)) ++len; return( len ); } bool is_armstrong(const unsigned int num,const unsigned int base=10) { unsigned int len=get_length(num,base); unsigned int sum=0; unsigned int tmp=num; while(tmp) { sum+=(unsigned int)std::pow((double)(tmp%base),(double)len); tmp/=base; } return(num==sum); } int main() { std::cout &lt;&lt; "Armstrong series (base 10):"; for(unsigned int num=0; num&lt;=0xffffffff; ++num) if(is_armstrong(num)) std::cout &lt;&lt; " " &lt;&lt; num; std::cout &lt;&lt; std::endl; return(0); }


C plus plus program to list all Armstrong number?

#include&lt;iostream&gt; #include&lt;vector&gt; unsigned count_digits (unsigned num, const unsigned base=10) { unsigned count=1; while (num/=base) ++count; return count; } class number { std::vector&lt;unsigned&gt; value; unsigned base; public: number (const unsigned _value, const unsigned _base=10): value {}, base {_base} { *this = _value; } number&amp; operator= (const unsigned _value); operator unsigned () const; bool is_narcissistic () const; }; number&amp; number::operator= (unsigned _value) { unsigned count = count_digits (_value, base); value.resize (count); while (count) { value[value.size()-count--] = _value%base; _value/=base; } return *this; } number::operator unsigned () const { unsigned num = 0; for (unsigned index=0; index&lt;value.size(); ++index) num += value[index]*static_cast&lt;unsigned&gt;(std::pow (base, index)); return num; } bool number::is_narcissistic () const { unsigned num = 0; for (unsigned index=0; index&lt;value.size(); ++index) num += static_cast&lt;unsigned&gt;(std::pow (value[index], value.size())); return num == static_cast&lt;unsigned&gt; (*this); } unsigned main() { const unsigned min=1; const unsigned max=100; std::cout &lt;&lt; "Narcissistic numbers in the range " &lt;&lt; min &lt;&lt; " through " &lt;&lt; max &lt;&lt; ":\n\t"; for (unsigned n=min; n&lt;=max; ++n) if (number(n).is_narcissistic()) std::cout &lt;&lt; n &lt;&lt; ' '; std::cout &lt;&lt; '\n' &lt;&lt; std::endl; }


Give the program to find Armstrong numbers between n and m in turbo c plus plus?

#include &lt;iostream&gt; #include &lt;math.h&gt; // for std::pow() unsigned int get_length(unsigned int num,const unsigned int base=10) { unsigned int len=1; while(num &amp;&amp; (num/=base)) ++len; return( len ); } bool is_armstrong(const unsigned int num,const unsigned int base=10) { unsigned int len=get_length(num,base); unsigned int sum=0; unsigned int tmp=num; while(tmp) { sum+=(unsigned int)std::pow((double)(tmp%base),(double)len); tmp/=base; } return(num==sum); } int main() { std::cout &lt;&lt; "Armstrong series (base 10):"; for(unsigned int num=0; num&lt;=0xffffffff; ++num) if(is_armstrong(num)) std::cout &lt;&lt; " " &lt;&lt; num; std::cout &lt;&lt; std::endl; return(0); }


Algorithm to find factorial using functions?

factorial using recursion style in c++ is unsigned int fact(unsigned int a) { if (a&lt;=1) return 1; else { f*=fact(a-1); return a; } } when using looping structure factorial is unsigned int fact (unsigned int n) { unsigned int i,f=1; for(i=1;i&lt;=n;i++) f*=i ; return f; }


How do you print a given integer in reverse using C plus plus?

#include &lt;iostream&gt; #include &lt;time.h&gt; unsigned int reverse( unsigned int num ) { const unsigned int base=10; unsigned int rev=0; while( num ) {rev*=base;rev+=num%base;num=num/base;} return( rev ); } int main () { srand(( unsigned ) time( NULL )); // Print 10 random numbers in reverse. for( int i=0; i&lt;10; ++i ) {unsigned int r = ( unsigned int ) rand();std::cout &lt;&lt; r &lt;&lt; " = " &lt;&lt; reverse(r) &lt;&lt; std::endl;} return(0); }


How to write a program to find the delimiter matching in stacks?

== == using recursions: unsigned int Factorial( unsigned int x) { if(x&gt;0) { return ( x * Factorial(x-1)); } else { return(1); } } factorial: unsigned int Factorial( unsigned int x) { unsigned int u32fact = 1; if( x == 0) { return(1); } else { while(x&gt;0) { u32fact = u32fact *x; x--; } } }