100% prog /* SET 1: m to the power of n */
/* SET 1: m to the power of n */
#include <stdio.h>
#include<math.h>
#include<conio.h>
void main()
{
int m,n, n_copy;
long int m_pow_n=1;
//clrscr();
printf("Enter the base m:");
scanf("%d",&m);
printf("Enter the exponent n (a positive integer):");
scanf("%d",&n);
n_copy=n;
while(n>0)
{
m_pow_n=m_pow_n*m;
n--;
}
printf("\n %d to the power of %d is %ld ",m,n_copy,m_pow_n);
}
#include <stdio.h>
#include<math.h>
#include<conio.h>
void main()
{
int m,n, n_copy;
long int m_pow_n=1;
//clrscr();
printf("Enter the base m:");
scanf("%d",&m);
printf("Enter the exponent n (a positive integer):");
scanf("%d",&n);
n_copy=n;
while(n>0)
{
m_pow_n=m_pow_n*m;
n--;
}
printf("\n %d to the power of %d is %ld ",m,n_copy,m_pow_n);
}
తెరమీద
Enter the base m:2
Enter the exponent n (a positive integer):5
2 to the power of 5 is 32
Enter the exponent n (a positive integer):5
2 to the power of 5 is 32
కామెంట్లు
కామెంట్ను పోస్ట్ చేయండి
దయచేసి మీ సలహాలను సూచనలను స్పష్టంగా పేర్కొనగలరు. plz see that ur comments are 'acceptable' in a value based society.