Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

- Write a program that creates a file named“Numbers.txt” if it does not exist. W

ID: 3614979 • Letter: #

Question

- Write a program that creates a file named“Numbers.txt” if it does not exist. Write 100 integerscreated randomly into the file using I/O functions. Integers arestored on separate lines. Read the data back from the file anddisplay it on the screen. -   Write a program that will count the numberof characters, words, and lines, in a file. Words are separated byspaces, tabs, or carriage return characters. The file name shouldbe entered by the user. - Write a program that creates a file named“Numbers.txt” if it does not exist. Write 100 integerscreated randomly into the file using I/O functions. Integers arestored on separate lines. Read the data back from the file anddisplay it on the screen. -   Write a program that will count the numberof characters, words, and lines, in a file. Words are separated byspaces, tabs, or carriage return characters. The file name shouldbe entered by the user. -   Write a program that will count the numberof characters, words, and lines, in a file. Words are separated byspaces, tabs, or carriage return characters. The file name shouldbe entered by the user.

Explanation / Answer

//Hope this will help you #include #include int main() { FILE *fp;char ch,filename[100];         int i,n; printf("Enter filename:"); scanf("%s",filename); fp = fopen(filename,"r"); if(fp==NULL) {      fp = fopen(filename,"w");        if(fp == NULL)         printf("Error increating file ");         else{        for(i=0;i