Program to find the value of e raised to power x using while
loop
Answer Posted / pragathi
#include<stdio.h>
void main()
{
int i=1,e,x,s,p=1;
printf("Enter e and x :");
scanf("%d%d",&e,&x);
while(i<=x)
{
p=p*e;
i++;
}
printf("power is %d ",p);
}
here pow(e,x) is calculated using this program.
| Is This Answer Correct ? | 46 Yes | 40 No |
Post New Answer View All Answers
What is the right type to use for boolean values in c? Is there a standard type? Should I use #defines or enums for the true and false values?
How can you return multiple values from a function?
What is use of bit field?
What is a void pointer? When is a void pointer used?
How do I round numbers?
What is the correct declaration of main?
Tell us two differences between new () and malloc ()?
What are identifiers in c?
a sequence of bytes with one to one corrspondence to those in the external device a) sequential addressing b) address c) byte code d) none
What are the types of operators in c?
When is a null pointer used?
Given below are three different ways to print the character for ASCII code 88. Which is the correct way1) char c = 88; cout << c << " ";2) cout.put(88);3) cout << char(88) << " "; a) 1 b) 2 c) 3 d) constant
What do you mean by keywords in c?
Explain the use of 'auto' keyword in c programming?
Write a program to replace n bits from the position p of the bit representation of an inputted character x with the one's complement. Method invertBit takes 3 parameters x as input character, p as position and n as the number of positions from p. Replace n bits from pth position in 8 bit character x. Then return the characters by inverting the bits.