Question: Question #2: Write a program that asks the user to enter two numbers: the base, x (real number) and the power, n (positive integer number)

 Question #2: Write a program that asks the user to enter
two numbers: the base, x (real number) and the power, n (positive

Question #2: Write a program that asks the user to enter two numbers: the base, x (real number) and the power, n (positive integer number) and computes Hint:- note that for any positive integer number n = *****... In times). Use a repetition structure to perform the repetitive multiplication Question #3 Re-write the program of Question #2 using data files. The input data numbers.txt contains several values for the base and power alternatively. Each time the program reads two numbers, computes and stores the result in the output file Results, txt. Below are examples of the input and out files 1.2345 1.2345 = 2.86 5 12.343 = 1881.36 12.345 2.00 16 = 65536.00 3 2.0 16 mumbers. Our Results, but #include #include int main(void) int number, reverse = 0, digit, temps FILE "infile, "outfile: int status //open the input file and check if an error occurred infile = fopen("numbers.txt'); //open the input file infile NULLY printf("Error: File\"numbers.txt not found!"); exit (1); //open the output file and check if error occurred outfile = fopen("Report.txt", "); iffoutfile NULLY printf("Error: File \"Report it can not be created a"); 1 status = fscanf(infile, "%d", &number): read first number from the file while status l-EOF //To read all the numbers in the file printf("%d is read from the file ", number): fprintf(outfile, "ad"number //compute the reverse of the number temp = number: reverse = 0; while(temp 1-0 digit temp%10: reverse reverse 10 digt; temp = temp/10, > printf("The reverse is: %d ", reverse fprintffoutfile, "d", reverse): // check whether the number is palindrome if(number reverse) printf("%d is a palindrome number nin", number: fprintf(outfile, "t Palindromein"); else! printf("%d is not a palindrome number lala", number fprintf(outfile, "t Non Palindrome //read another number from the file status = fscanffinfile, "%d", &number): //close the files fclose(infile): fclose(outfie) return 0

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!