Question: C Programming: Both programs should be saved into one c file 1. Write a program to copy two text files to a third text file.

C Programming: Both programs should be saved into one c file 1. Write a program to copy two text files to a third text file. Ask the user to enter 2 input file names: f1name, f2name, and one output file name f3name. Declare 3 files: f1, f2, f3. Open f1, f3 and copy f1 to f3. Close f1, and open f2 and copy it to f3. Close f2. Close f3.

2. Write a program that loops and to ask the user to enter a positive integer num. Enter 0 to quit. write a function called: bool isPrime(int n) { }

Call isPrime it in the main program to check if the entered number is prime or not.

A number is a prime number if it is only divisible by itself and by 1. 1 and 2 are prime. Return true. All remaining even numbers are not prime. Loop i from 3 to sqrt(n) and skip even numbers. See if n%i is 1 or 0. If it is 0, then it is not prime; return false. Return true if the loop finishes.

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!