by Dinesh Thakur Category: C Programming (Pratical)

This program asks user to replace the occurrence of M by N. user declare variables and some method for replacement of occurrences. Like user ask to put file name here if condition will come in use for checking out the file exist or not if not the message will be “file can’t be open” else the while condition will use in for passing to “EOF”. If the condition match if(ch=='M'||ch=='m') then the process will use method to replace the letter with N from M. display result on the screen at last instance.

Problem Statement:

This is C program that ask user to replace the Letter M by N.

  1. Declare the variables.
  2. Using control statements.
  3. Display result on the screen.

Here is C source code to replace the Letter M by N. The output of this program shown below. 

void main()
     FILE *fp1;
     char ch,fname[20];
     printf("Enter file name=");
     scanf("%s",& fname);
            printf("File can't be opened");

About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.C.A, MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.