diff options
Diffstat (limited to '659/CH6/EX6.1/exm6_1.sce')
-rwxr-xr-x | 659/CH6/EX6.1/exm6_1.sce | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/659/CH6/EX6.1/exm6_1.sce b/659/CH6/EX6.1/exm6_1.sce new file mode 100755 index 000000000..d19e45583 --- /dev/null +++ b/659/CH6/EX6.1/exm6_1.sce @@ -0,0 +1,13 @@ +// Example 6.1
+//A program to evaluate the equation y=x^n when n is a non-negative integer.
+
+x=input("Enter the value of x:");
+n=input("Enter the value of n:");
+y=1.0;count=1; //intialization
+//Loop begins
+while(count<=n) //Testing
+ y=y*x;
+ count=count+1; //Increamenting
+end
+//End of loop
+printf("x = %f; n = %d; x to power n = %f\n",x,n,y);
|