Pages

Showing posts with label program. Show all posts
Showing posts with label program. Show all posts

Wednesday, February 18, 2015

C program to find sum of series 1 x x 2 x n

C++ program to find sum of series 1+x+x^2+......+x^n


#include<iostream.h>
#include<conio.h>
#include<math.h>


void main()
{
clrscr(); //to clear the screen
long i,n,x,sum=1;

cout<<"1+x+x^2+......+x^n";
cout<<"

Enter the value of x and n:";

cin>>x>>n;


for(i=1;i<=n;++i)
sum+=pow(x,i);
cout<<"
Sum="<<sum;

getch(); //to stop the screen
}

Read more »

Tuesday, February 17, 2015

C program to find sum of series 1 x x 2 x n

C program to find sum of series 1+x+x^2+......+x^n

#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
 int i,n;
float x,sum=0;
clrscr(); //to clear the screen
printf("1+x+x^2+......+x^n");
printf("

Enter the value of x and n:");

scanf("%f%d",&x,&n);

for(i=1;i<=n;++i)
sum+=pow(x,i);
 sum++;
printf("
Sum=%f",sum);

getch(); //to stop the screen
}
Read more »

Monday, February 16, 2015

C Program to print three numbers in descending order

#include<iostream.h>
#include<conio.h>


void main()
{
clrscr();
int a,b,c,big1,big2,big3;
cout<<"Enter three numbers:";
cin>>a>>b>>c;


 big1=a;
if(b>big1)
big1=b;
else
if(c>big1)
big1=c;


if(big1==a)
{
if(b>c)
{
big2=b;
big3=c;
}
else
{
big2=c;
big3=b;
}
}


else
{
if(big1==b)
if(a>c)
{
big2=a;
big3=c;
}
else
{
big2=c;
big3=a;
}


else
{
if(a>b)
{
big2=a;
big3=b;
}
else
{
big2=b;
big3=a;
}
}
}
cout<<"

Numbers in descending order......
";

cout<<big1<<" "<<big2<<" "<<big3;
getch();
}
Read more »

Friday, February 13, 2015

C program to check whether a given number is even or odd


C program to check whether a given number is even or odd

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

void main()
{
int n;
clrscr();
printf("Enter any number:");
scanf("%d",&n);

if(n%2==0)
printf("The number is even");
else
printf("The number is odd");

getch();
}
Read more »

Tuesday, February 3, 2015

YouTube partner program now available in the Philippines

I have some good news for YouTube channel owners residing in the Philippines - the YouTube partner program is now officially available. If you are in the Philippines and you visit the YouTube partner page, you will now be able to access the application link. Users from countries not eligible to join the partner program will get redirected to the homepage when they try to access the partner page. That is no longer the case for users from the Philippines. Currently, there are around 20+ countries included in the partner program. Some of the countries included are Argentina, Sweden, New Zealand and the Czech Republic. Apply now!
Read more »