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
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 |
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 |
Differentiate between a deep copy and a shallow copy?
make a middle node of doubly linklist to the top of the list
Write a program which uses Command Line Arguments
What is new in c++?
What is the difference between = and == in C?
20 Answers Christ University, Intel,
Are c and c++ similar?
How can we access protected and private members of a class?
What is a concrete class?
What is a memory leak c++?
Define a program that reads two matrices of size 3x3 with real values from the user then prints their sum, difference and multiplication.
What number of digits that can be accuratly stored in a float (based on the IEEE Standard 754)? a) 6 b) 38 c) An unlimited number
Do you know what are pure virtual functions?