write a program that a 5 digit number and calculates 2
power that number and prints it.

Answers were Sorted based on User's Feedback



write a program that a 5 digit number and calculates 2 power that number and prints it...

Answer / ayushi rastogi

/* We assume that user enter 5 digit No */

#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
double No,length=2;
double pwrNo;
printf("Please Enter the 5 digit No.:");
printf("\n");
scanf("%d",&No);
pwrNo=pow(No,2);
printf("\n");
printf("Power of %u No is %u",No,pwrNo);

}

Is This Answer Correct ?    6 Yes 5 No

write a program that a 5 digit number and calculates 2 power that number and prints it...

Answer / umesh

// This will yield the result if user enters only 5 digit
number.

//import headers

class power
{
public static void main(string args[])
{
system.out.println("Enter 5 digit number : ");
n = system.in.readline();
b =0;
len = n.length();

if(len == 5)
{
a=Integer.ParseInt(n)
for i=0;i<a;i++
{
b = 2*2;

}
system.out.println("2 power entered 5 digit number is :
"+b)
}
else
{
system.out.println("Entered number in more/less than
5 digits")
}

}

//Sorry, not much familiar about the syntax.. but here is
the logic..

Is This Answer Correct ?    3 Yes 6 No

Post New Answer

More C++ General Interview Questions

What is the full name of logo?

0 Answers  


How do you instruct your compiler to print the contents of the intermediate file showing the effects of the preprocessor?

0 Answers  


What is lvalue?

0 Answers  


Why can you not make a constructor as const?

3 Answers  


What operators can you overload in c++?

0 Answers  






What is meant by reference variable in C++?

1 Answers  


What is OOPs

12 Answers   CA,


Write a Program for read a line from file from location N1 to N2 using command line arguments. Eg:exe 10 20 a.c

0 Answers  


Which c++ operator cannot overload?

0 Answers  


Can a new be used in place of old mallocq? If yes, why?

0 Answers  


write asingle linked list which read from two list & the do the following 1 sort the prime & nonprime num (prime should be less tn nonprime) 2 each node has a prime num followd by nonprime 3 add a new node into its sutable plce 4 erase the most three duplicated non prime num 5 find the least duplicated prime num

0 Answers   Care,


how to find the maximum of 10 numbers ?

5 Answers  


Categories