Programmator
Programmator
  • Home
  • Download
  • Social
    • YouTube
    • Instagram
    • Facebook
    • Telegram
  • Features
    • C/C++
    • Java
  • Contact Us

C Program to Remove All Occurrences of a Character in a String


Write a C Program to Remove All Occurrences of a Character in a String with example.
This program allows the user to enter a string (or character array), and a character value.

In this, 
we have to delete character in string: i.e.
Entering name Nilesh pPatel
we have to delete p character and make final sting like Nilesh Patel

  •  Program:

#include<stdio.h>
#include<conio.h>

int main()
{
    char str[80], ch;
int i,j;

    printf("\n Enter string :");
    scanf("%[^\n]s",str);
    fflush(stdin);
printf("\n Enter character to delete :");
scanf("%c",&ch);

    for(i=0;str[i]!='\0';i++)
    {
        if(str[i]==ch)
        {
            for(j=i;j<str[j]!='\0';j++)
            {
                str[j]=str[j+1];
            }
            i--;
        }
    }
printf("\n Final string :%s", str);
    return 0;
}

  •  Output:


Enter string :Nilesh pPatel Enter character to delete :p Final string :Nilesh Patel


  •  Visit:

Write a C program to computer Fahrenheit from centigrade ( f=1.8*c+32 ) Here
Write a C program to find out distance travelled by the equation d=ut+at^2 Here
Write a C program to find that the accepted number is negative or positive or zero Here
Write a program to read mark of a student from keyboard the student is pass or fail ( using if else ) Here
Write a program to read three numbers from keyboard and find out maximum out of these three. (nested if else) Here
Write a program to check whether the entered character is capital, small letter, digit or any special character Here
Write a program to read marks from keyboard and your program should display equivalent grade according to following table (if else ladder) Here
Write a C program to prepare pay slip using following data Here
Write a C program to read no 1 to 7 and print relatively day Sunday to Saturday Here
Write a C program to find out the Maximum and Minimum number from given 10 numbers Here
Write a C program to input an integer number and check the last digit of number is even or odd Here 
Write a C program to find factorial of a given number Here
Write a C program to reverse a number Here
Write a C program to generate first n number of Fibonacci series Here
Write a C program to find out sum of first and last digit of a given number Here
Write a C program to find the sum and average of different numbers Here
Write a program to calculate average and total of 5 students for 3 subjects Here
Read five persons height and weight and count the number of person having height greater than 170 and weight less than 50 Here
Write a program to check whether the given number is prime or not Here
Write a program to evaluate the series 1^2+2^2+2+3^2+……+n^2 Here
Write a C program to find 1+1/2+1/3+1/4+....+1/n Here
Write a C program to find 1+1/2!+1/3!+1/4!+.....+1/n! Here
Write a C program to evaluate the series sum=1-x+x^2/2!-x^3/3!+x^4/4!......-x^9/9! Here
Write a C program to read and store the roll no and marks of 20 students using array Here
Write a C program to find out which number is even or odd from list of 10 number using array Here
Write a program to find maximum element from 1-Dimensional array Here
Write a C program to calculate the average, geometric and harmonic mean of n elements in a array Here
Write a program to delete a character in given string Here
Write a program to replace a character in given string Here
Write a program to find a character from given string Here
Write a program to sort given array in ascending order Here
Write a program to reverse string Here
Write a program to convert string into upper case Here
Write a program that defines a function to add first n numbers Here
Write a function in the program to return 1 if number is prime otherwise return 0 Here
Write a function Exchange to interchange the values of two variables, say x and y. illustrate the use of this function in a calling function Here
Write a C program to use recursive calls to evaluate F(x) = x – x3 / 3! + x5 / 5 ! – x7 / 7! + … xn/ n! Here
Write a program to find factorial of a number using recursion Here
Write a function that will scan a character string passed as an argument and convert all lowercase character into their uppercase equivalents Here
Write a program to read structure elements from keyboard Here

The c program calculates geometric mean, average mean and harmonic mean using their respective formulas. It simply applies these formula on the given input to calculate and print the result.

In this, we are using following formula directly in the code:

Write a program that reads a series of n numbers and calculates the average, geometric and harmonic mean of n elements in an array in c
C program to find the largest number in an array

How to find max value in an array?

Algorithm to get max value: we assume that it's present at the beginning of the array.
Write a C program to find out which number is even or odd from list of 10 number using array

C program to count the total number of even and odd elements in an array. In this post, we will brief in on the numerous methods to count the total number of even and odd elements in an array in c programming.
Write a C program to read and store the roll no and marks of 20 students using array

Define a structure, student, to store the following data about a student:
Roll number (int), Marks (int)
Write a C program to evaluate the series sum=1-x+x^2/2!-x^3/3!+x^4/4!......-x^9/9!
Lets write a C program to add first seven terms of the following series 1+1/2!+1/3!+1/4!+.....+1/n!

We’ve also written the C program to ask the user to enter the number of terms of the series that has to be added. You can find code to both of it below.

C Program To Find Sum of Series 1+1/2!+1/3!+1/4!+.....+1/n!
Program to sum of series 1+1/2+1/3+1/4+....+1/n

In this program, if inverse of a sequence follow rule A.P i.e , Arithmetic progression, then it is said to be in harmonic progression can be denoted: 
Program to evaluate the series 1^2+2^2+2+3^2+……+n^2

Here is source code of the C Program to Find the Sum of Series 1^2 + 2^2 + …. + n^2. The C program is successfully compiled and run on a Linux system. The program output is also shown below.
C Program to check whether a number is prime or not

In this example, you will learn to check whether an integer entered by the user is a prime number or not.
Program to read five person height and weight:

Program to read five persons height and count the number of person having height greater than 170 and weight less than 50 using c programming
Write a program to calculate average and total of 5 students for 3 subjects (use nested for loops)

This program helps the user to enter five different values for five subjects. And then this c program calculate the Total, Average, and Percentage of those Five Subjects.
Write a C program to find the sum and average of different numbers which are accepted by user as many as user wants

In this program sum and average of the given number are calculated using while.

Write a C program to find product of digits of a number using while loop.
Write a C program in C to multiply the digits of a number.

C program to find fibonacci series for first n terms:

This C Program calculate the Fibonacci numbers in the series. The first two numbers in the Fibonacci sequence are 0 and 1 and each subsequent number is the sum of the previous two. 
This program reverse the number entered by the user, and then prints the reversed number on the screen.

C Program to find factorial of a number

In this program, we will read and integer number and find the factorial using different methods - using simple method (without using user define function), using User Define Function and using Recursion.

What is factorial?

Program to check Even or Odd:

In this question, you will learn to check whether a number entered by the user is even or odd.

Program to find maximum and minimum element in array.

Write a C program to find out the Maximum and Minimum number from given 10 numbers.

As we all know, arrays are a collection of a bunch of elements in a sequential pattern in a horizontal direction. Arrays form a very important of C programming.

C Program to Print Day Name of Week using Else If

How to write a C Program to Print Day Name of Week using Else If statement, and Switch Condition with examples.
Given the following constrains and we have to calculate net salary of an employee.

C program to read and print an Employee’s Details using Structure.

 Marks                                       Grade

 100-80                                       Distinction     

 79-60                                         First class

 59-40                                         Second class

 < 40                                           Fail             


Program to calculate grade according to marks:

Grade mark in c program:

Write a program to read marks from keyboard and your program should display equivalent grade according to following table (if else ladder).

Write a C program to input a character from user and check whether given character is alphabet, digit or special character using if else. How to check if a character is alphabet, digits or any other special character using if else in C programming. Logic to check alphabet, digit or special character in C programming.
Write a C program to find maximum between three numbers using nested if else or nested if. How to find maximum or minimum between three numbers using if else in C programming. Logic to find maximum or minimum between three numbers in C program.

Write a c program to find the largest number among three numbers. You will learn to find the largest number among three numbers.

C program to check student is pass or fail:


The C program to display student results demonstrates the working of conditional statement in the C language.

Write a C program to check positive, negative or zero using simple if or if else. C program to input any number from user and check whether the given number is positive, negative or zero. Explain, how to find that the accepted number is negative, positive or zero in C programming.
Calculate total distance traveled by a vehicle in ' t ' seconds is given by distance.

Formula of distance:

d = ut+at^2

Where, ' u ' is the initial velocity ( meter per second ), ' a ' is the acceleration. Write a program to evaluate the distance travelled at regular intervals of time, given the value of ' u ' and ' a '. The program should provide the flexibility to the user to select his own time intervals and repeat the calculations for different values of ' u ' and ' a '.

Given below is a C program to find out distance travelled by the upper equation:
Newer Posts Older Posts Home

Loading latest videos...

ABOUT

I could look back at my life and get a good story out of it. It's a picture of somebody trying to figure things out.

SUBSCRIBE & FOLLOW

POPULAR POSTS

  • Software Project Management - 3171609 - WINTER 2022 GTU Paper Solution
  • Write a java program to display Fibonacci series
  • Write a program to that performs as calculator (Addition, Multiplication, Division, Subtraction)
  • Java program to generate multiplication table
  • Write a java program to find GCD of two numbers
Powered by Blogger

Archive

  • November 20251
  • February 20241
  • January 20242
  • November 20234
  • October 20236
  • September 20236
  • August 20235
  • April 20231
  • March 20231
  • October 20221
  • August 20223
  • July 20222
  • May 20223
  • April 20222
  • March 20221
  • January 20221
  • December 20216
  • November 20214
  • October 20211
  • September 20216
  • August 202127
  • July 20216

Report Abuse

Copyright

  • Home

About Me

Nilesh Patel
View my complete profile

Copyright © Programmator. Designed by ProbleSolvable