/* Write a C program to calculate the following Sum:
Sum=1-x2/2! +x4/4!-x6/6!+x8/8!-x10/10!
*/
#include <stdio.h>
#include <math.h>
void main()
{
int counter,f_coun;
float sum=0,x,power,fact;
clrscr();
printf("<-----------------------PROGRAM FOR SUM OF EQ. SERIES----------------------->");
printf("\n\n\tEQUATION SERIES : 1- X^2/2! + X^4/4! - X^6/6! + X^8/8! - X^10/10!");
printf("\n\n\n\tENTER VALUE OF X : ");
scanf("%f",&x);
for(counter=0, power=0; power<=10; counter++,power=power+2)
{
fact=1;
//CALC FACTORIAL...
This is default featured slide 1 title
Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.
This is default featured slide 2 title
Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.
This is default featured slide 3 title
Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.
This is default featured slide 4 title
Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.
This is default featured slide 5 title
Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.
Sunday, 22 July 2012
C PROGRAM TO FIND THE SUM OF INDIVIDUAL DIGITS OF A POSITIVE INTEGER
02:11
1 comment
/* Write a C program to find the sum of individual digits of a positive integer.*/
#include<stdio.h>
#include<conio.h>
void main()
{
int num, k=1, sum=0;
clrscr();
printf("Enter the number whose digits are to be added:");
scanf("%d",&num);
while(num!=0)
{
k=num%10;
sum=sum+k;
k=num/10;
num=k;
}
printf("Sum of the digits:%d",sum);
getch();
}...
PROGRAM TO GENERATE ALL THE PRIME NUMBERS BETWEEN 1 AND N,WHERE N IS A VALUE SUPPLIED BY THE USER
02:03
No comments
/* Write a C program to generate all the prime numbers between 1 and n, where n is a value supplied by the user. */
#include <stdio.h>
void main()
{
int no,counter,counter1,check;
clrscr();
printf("<-----------------------PRIME NO. SERIES------------------------>");
printf("\n\n\n\t\t\tINPUT THE VALUE OF N: ");
scanf("%d",&no);
printf("\n\nTHE PRIME NO. SERIES B/W 1 TO %d : \n\n",no);
for(counter = 1; counter <= no; counter++)
{
check = 0;
//THIS LOOP WILL CHECK A NO TO BE PRIME NO. OR NOT.
for(counter1...
PROGRAM TO FIND THE FIBONACCI SERIES UP TO N NO. IN SERIES
02:00
No comments
/* A Fibonacci Sequence is defined as follows: the first and second terms in the sequence are 0 and 1. Subsequent
terms are found by adding the preceding two terms in the sequence. Write a C program to generate
the first n terms of the sequence.
*/
#include <stdio.h>
void main()
{
int num1=0, num2=1,no,counter,fab;
clrscr();
printf("<===========PROGRAM TO FIND THE FIBONACCI SERIES UP TO N NO. IN SERIES=========>");
printf("\n\n\n\t\tENTER LENGTH OF SERIES (N) : ");
scanf("%d",&no);
printf("\n\n\t\t\t<----FIBONACCI...
Subscribe to:
Posts (Atom)