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

  •  Program:

#include<stdio.h>
#include<math.h>


int main()
{
    float a[50], sum=0, sum1=0, sum2=1;
int i,n;

    printf("\n How many number you want to enter :");
scanf("%d",&n);

    for(i=0; i<n; i++)
    {
        printf("\n Enter value [%d] :",i+1);
        scanf("%f",&a[i]);
        sum=sum+a[i];
        sum1=sum1+(1.0/a[i]);
        sum2=sum2*a[i];
    }
printf("\n Aevrage :%f", sum/n);
    printf("\n Geometric mean :%f", pow(sum2,(1.0/n)));
    printf("\n Harmonic mean :%f", n*pow(sum1,-1));
    return 0;
}

  •  Output:


How many number you want to enter :5 Enter value [1] :17 Enter value [2] :36 Enter value [3] :96 Enter value [4] :47 Enter value [5] :27 Aevrage :44.600000 Geometric mean :37.540224 Harmonic mean :32.189201

 

  •  Explain:       

  1. Getting input array form a user 
  2. Then, applying formula on the given set of element, that would output average, geometric and harmonic mean

  •  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

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. then compare it with the second element. If the second element is greater than the first, the index is updated. Repeat it till the last index of the array. similarly, we can find the minimum element in an array.

If the maximum element is present two or more times in the array, then the index at which it occurs first is printed or the maximum value at the smallest index. You can easily modify the program to print the largest index at which it's present. You can also store all indexes at which it's present in the array.

  •  Program:

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

int main()
{
    int a[50], i, n, b;
    printf("\n Enter a number :");
    scanf("%d",&n);
    for(i=0; i<n; i++)
    {
        printf("\n Enter a number [%d] :",i+1);
        scanf("%d",&a[i]);
        if(i==0)
        {
            b=a[i];
        }
        else
        {
            if(b<a[i])
            {
                b=a[i];
            }
        }
    }
    printf("\n Maximum number is :%d",b);
    getch();    
}

  •  Output:


Enter a number :5 Enter a number [1] :34 Enter a number [2] :5 Enter a number [3] :67 Enter a number [4] :35 Enter a number [5] :74 Maximum number is :74


  •  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

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.

An array, as we all know, is a collection of elements in a horizontal fashion which are denoted with the help of specific location based parameters known as pointers. Array form an integral part of c programming.

In this program, If a number is divisible by 2 then the number is even else the number is odd. To display the all, initialize array and then check each element of the array.

  •  Program:

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

int main() 
{
   int a[10],i;
   for(i=0;i<9;i++)
   {
      printf("\n Enter Value in Array at Position [%d] :",i+1);
      scanf("%d",&a[i]);
   }
   for(i=0;i<9;i++)
   {
      if(a[i]%2==0)
      {
         printf("\n %d is an EVEN number.",a[i]);
      }
      else
      {
         printf("\n %d is an ODD number.",a[i]);
      }
   }
   return 0;
}

 

  •  Output:


Enter Value in Array at Position [1] :46 Enter Value in Array at Position [2] :27 Enter Value in Array at Position [3] :96 Enter Value in Array at Position [4] :48 Enter Value in Array at Position [5] :69 Enter Value in Array at Position [6] :79 Enter Value in Array at Position [7] :71 Enter Value in Array at Position [8] :20 Enter Value in Array at Position [9] :44 46 is an EVEN number. 27 is an ODD number. 96 is an EVEN number. 48 is an EVEN number. 69 is an ODD number. 79 is an ODD number. 71 is an ODD number. 20 is an EVEN number. 44 is an EVEN number.


  •  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

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)

Suppose that the class has 20 students. use an array of 20 elements of type student.
create a function to read the student's data into the array. 

  •  Program:

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

int main()
{
   int a[20], b[20], i;
   for(i=0; i<20; i++)
   {
      printf("Enter roll number [%d]",i+1);
      scanf("%d",&a[i]);
      printf("Enter marks [%d]",i+1);
      scanf("%d",&b[i]);
   }
   for(i=0; i<20; i++)
   {
      printf("\n Roll number: %d Marks is: %d",a[i],b[i]);
   }   
   getch();
   return 0;
}

  •  Output:

Enter roll number [1]: 3 Enter marks [1]: 32 Enter roll number [2]: 5 Enter marks [2]: 23 Enter roll number [3]: 6 Enter marks [3]: 86 Enter roll number [4]: 2 Enter marks [4]: 96 Enter roll number [5]: 7 Enter marks [5]: 50 Enter roll number [6]: 4 Enter marks [6]: 97 Enter roll number [7]: 1 Enter marks [7]: 36 Enter roll number [8]: 9 Enter marks [8]: 68 Enter roll number [9]: 11 Enter marks [9]: 94 Enter roll number [10]: 10 Enter marks [10]: 70 Enter roll number [11]: 14 Enter marks [11]: 88 Enter roll number [12]: 12 Enter marks [12]: 69 Enter roll number [13]: 13 Enter marks [13]: 70 Enter roll number [14]: 15 Enter marks [14]: 59 Enter roll number [15]: 16 Enter marks [15]: 73 Enter roll number [16]: 17 Enter marks [16]: 66 Enter roll number [17]: 19 Enter marks [17]: 75 Enter roll number [18]: 20 Enter marks [18]: 55 Enter roll number [19]: 18 Enter marks [19]: 99 Enter roll number [20]: 21 Enter marks [20]: 89 Roll number: 3 Marks is: 32 Roll number: 5 Marks is: 23 Roll number: 6 Marks is: 86 Roll number: 2 Marks is: 96 Roll number: 7 Marks is: 50 Roll number: 4 Marks is: 97 Roll number: 1 Marks is: 36 Roll number: 9 Marks is: 68 Roll number: 11 Marks is: 94 Roll number: 10 Marks is: 70 Roll number: 14 Marks is: 88 Roll number: 12 Marks is: 69 Roll number: 13 Marks is: 70 Roll number: 15 Marks is: 59 Roll number: 16 Marks is: 73 Roll number: 17 Marks is: 66 Roll number: 19 Marks is: 75 Roll number: 20 Marks is: 55 Roll number: 18 Marks is: 99 Roll number: 21 Marks is: 89

  •  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

Write a C program to evaluate the series sum=1-x+x^2/2!-x^3/3!+x^4/4!......-x^9/9!

  •  Program:

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

int main()
{
    int n, i, j, fact=1;
float sum=0;
    printf("Enter value of n : ");
    scanf("%d",&n);
 
    for(i=1;i<=n;i++)
    {
        fact=1;
        for(j=i;j>0;j--)
        {
            fact=fact*j;
        }
        sum=sum+(1.0/fact);
    }
    printf("\n Sum of series : %f",sum);
    return 0;
}

  •  Output:

Enter value of n : 4 Sum of series : 1.708333

  •  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

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:

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

int main()
{
int n,i,j,fact=1;
float sum=0;
printf("\n Enter Value of n : ");
scanf("%d",&n);
for(i=1; i<=n; i++)
{
    fact=1;
    for(j=i; j>0; j--)
    {
        fact=fact * j;
     }
    sum=sum+(1.0/fact);
}
printf("\n Sum of Series = %f",sum);
return 0;
}


  •  Answer:

 Enter Value of  n : 5

 Sum of Series = 1.716667


  • 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

Newer Posts Older Posts Home

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

  • Write a C program to enter a distance in to kilometer and convert it in to meter, feet, inches and centimeter
  • Write a C program to computer Fahrenheit from centigrade ( f=1.8*c+32 )
  • Write a C program to interchange two numbers
  • Write a program to that performs as calculator (Addition, Multiplication, Division, Subtraction)
  • Write a C program to find out the Maximum and Minimum number from given 10 numbers

Advertisement

👆 Shopping 👆

Powered by Blogger

Archive

  • 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 us
  • Privacy Policy
  • Disclaimer
  • Contact Us

About Me

Nilesh Patel
View my complete profile

Copyright © Programmator. Designed by OddThemes