write a program that takes 5 digit no and calculate 2 power
that no and print it.

Answers were Sorted based on User's Feedback



write a program that takes 5 digit no and calculate 2 power that no and print it...

Answer / venkataramakrishna.danduri

#include <iostream.h>

void main()
{
int b = 0;
int num5digit;
cin>>num5digit;
b = 1<< num5digit;
cout<<"b = "<<b;
}

Is This Answer Correct ?    0 Yes 0 No

write a program that takes 5 digit no and calculate 2 power that no and print it...

Answer / kathir

#include<iostream.h>
void main()
{
int a,n=0;
cout<<"Enter the 5 didgit no:"<<endl;
cin>>a;
n=(a*a);
cout<<"The two power given no is:"<<n<<endl;

}

Is This Answer Correct ?    4 Yes 6 No

write a program that takes 5 digit no and calculate 2 power that no and print it...

Answer / yeah

#include<iostream.h>
#include<math.h>
void main()
{
int a,n=1,i;
cout<<"enter Num";
cin>>a;
//n=pow(2,a);
for(i=0;i<a;i++)
n*=2;
cout<<n;
}

Is This Answer Correct ?    3 Yes 6 No

Post New Answer

More C++ General Interview Questions

Given the following seqment of code containing a group of nested if instructions: y = 9; if ((x==3) || (x == 5)) y++; else if (x == 2) y *= 2; else if (x == 4 ) y-= 7; else y = 8; Enter a segment of code (without any IF statements) that does exectly the same thing using the switch structure.

1 Answers  


How to stop conversions among objects?

5 Answers   Symphony,


Is recursion allowed in inline functions?

0 Answers  


Give the difference between the type casting and automatic type conversion. Also tell a suitable C++ code to illustrate both.

0 Answers   TCS,


What is pair in c++?

0 Answers  


Explain the scope resolution operator?

2 Answers  


How is static data member similar to a global variable?

0 Answers  


Define the process of handling in case of destructor failure?

0 Answers  


What is the difference between #import and #include in c++?

0 Answers  


Check for Balanced Parentheses using Stack?

1 Answers  


What is a mutable member?

1 Answers  


Why is c++ called oops?

0 Answers  


Categories