2079 10

CSC115 ยท 2079 ยท 5 marks

Suppose a file named 'Num.txt' contains a list of integers. Write a program to extract the prime numbers only from that file and write them on 'Prime.txt' file.

Suppose a file named 'Num.txt' contains a list of integers. Write a program to extract the prime numbers only from that file and write them on 'Prime.txt' file. [5]

C ProgrammingChapter 10: File Handling in CInput Output Operations in File
  • Read integers from Num.txt using fscanf() - Check each integer for primality using a loop - Write prime numbers to Prime.txt using fprintf() - Use FILE pointer and formatted I/O --- --- Step Description ------------------- fopen("Num.txt", "r") Opens Num.txt in read mode; returns FILE pointer f...