jituTechnology

jituTechnology

A program for floating number to be raised to an integer number using function.

2.           A program for floating number to be raised to an integer number using function.
Codes
/*A program for floating number to be raised to an integer number using function*/
/*Programed by          Jitendra Kr Yadav
                        10116
                        22 Mar,2011*/
#include<stdio.h>
#include<conio.h>
void power(float, int);
main()
{
float a;
int b;
printf(“Enter the number: “);
scanf(“%f”,&a);
printf(“Enter the value of power: “);
scanf(“%d”,&b);
power(a,b);
getch();
}
void power(float x,int y)
{
float z=x;
for(int i=1;i<=y-1;i++)
{
x=x*z;
}
printf(“The value is: %.2f\n\n”,x);
printf(“Press any key to continue…”);
}
Output
Enter the number: 2.5
Enter the value of power: 2
The value is: 6.25
Press any key to continue…

No comments yet.

Add a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.



Connect with Me

GPO 8973 NPC 541; Kathmandu Nepal
Phone: +977 9851236800

Calendar

May 2024
S M T W T F S
 1234
567891011
12131415161718
19202122232425
262728293031