//Downloaded From www.c4cpp.co.nr
//(C)2009.All rights reserved.
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int i,s=0;
for(i=2;i<=100;i=i+2)
{
s=s+i;
cout<<"+"<<i;
}
cout<<"="<<s;
getch();
}
Programs Can Also Be Downloaded From The Folders Below....[Or Scroll Down]
Showing posts with label For Beginners. Show all posts
Showing posts with label For Beginners. Show all posts
Sum of n even Nos.
Click Here To Download C++ File Of This Program
Lowercase Vowels
Click Here To Download C++ File Of This Program
//prg to count no of lower case vowels in a string
//Downloaded From www.c4cpp.co.nr. (C)2009.All rights reserved.
#include<iostream.h>
#include<conio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<ctype.h>
void main()
{
clrscr();
char st[100];
int l,c,i;
cout<<"Enter the string"<<endl;
cin.getline(st,100);
l=strlen(st);
for(i=0;i<=l;i++)
{
if(islower(st(i))) && ((st(i)==a)||(st(i)==e)||(st(i)==i)||(st(i)==o)||(st(i)==u))
c++;
}
cout<<"The no is"<<c;
getch();
}
Square or Cube Acc Input
Click Here To Download C++ File Of This Program
//prg to find sq + cube acc to input
//Downloaded From www.c4cpp.co.nr. (C)2009.All rights reserved.
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int n,s;
cout<<"Enter a no"<<endl;
cin>>n;
if((n%2)==0)
s=n*n;
else
s=n*n*n;
cout<<"Rsult = "<<s;
getch();
}
Sqrt & Power
Click Here To Download C++ File Of This Program
//prg to find sqrtn if n>0 & n5 if n<0
//Downloaded From www.c4cpp.co.nr. (C)2009.All rights reserved.
#include<iostream.h>
#include<math.h>
#include<conio.h>
void main()
{
clrscr();
int n,r;
cout<<"Enter no"<<endl;
cin>>n;
if((n>0)&&(n%2==1))
r = sqrt (n);
else if((n<0))
r=pow(n,5);
cout<<"Result ="<<r;
getch();
}
Quotient & Remainder
Click Here To Download C++ File Of This Program
//prg to read 2 no & print Quotient & Remainder
//Downloaded From www.c4cpp.co.nr. (C)2009.All rights reserved.
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int q,r,a,b;
cout<<"Enter 2 nos :"<<endl;
cin>>a>>b;
q=a/b;
r=a%b;
cout<<"Quotient = "<<q<<endl<<"Remainder = "<<r;
getch();
}
Multiplication Table
Click Here To Download C++ File Of This Program
//prg for mult table till 10
//Downloaded From www.c4cpp.co.nr. (C)2009.All rights reserved.
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int i,n,a;
cout<<"Enter the no upto which u want table"<<endl;
cin>>a;
for(i=1;i<=10;i++)
cout<<i<<"x"<<a<<"="<<a*i<<endl;
getch();
}
Largest of Two Nos
Click Here To Download C++ File Of This Program
//lar & small
//Downloaded From www.c4cpp.co.nr. (C)2009.All rights reserved.
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int b,s,g=0,l=35000,n,i,a;
cout<<"Enter how many nos u want to enter"<<endl;
cin>>n;
for(i=1;i<=n;i++)
{
cin>>a;
if(a>g)
g=a;
if(a<l)
l=a;
}
cout<<"Big ="<<g;
cout<<"Small ="<<l;
getch();
}
Height to Yard,Feet & Inches
Click Here To Download C++ File Of This Program
//prg to ask your height & convert into feet & inches
//Downloaded From www.c4cpp.co.nr. (C)2009.All rights reserved.
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
float h,i,f;
cout<<"Enter your heught in cms :"<<endl;
cin>>h;
f=h/30.48;
cout<<"Height in feets :"<<f<<endl;
i=h/2.54;
cout<<"Height in inch :"<<i<<endl;
getch();
}
Check for Odd or Even
Click Here To Download C++ File Of This Program
//prg to find a no is even or odd
//Downloaded From www.c4cpp.co.nr. (C)2009.All rights reserved.
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int e;
cout<<"Enter a no :"<<endl;
cin>>e;
if (e==0)
cout<<"The no is neither even or odd "<<endl;
if (e%2==0)
cout<<"The no is even"<<endl;
else
cout<<"The no is odd "<<endl;
getch();
}
Celcius To Farenheit
Click Here To Download C++ File Of This Program
//prg to read temp in celsius & display in F
//Downloaded From www.c4cpp.co.nr. (C)2009.All rights reserved.
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
float k,c;
cout<<"Enter the temp in Celsius :";
cin>>c;
k=(9/5)*c+32;
cout<<"Temperature in Farenheit = "<<k;
getch();
}
Calculate Bill
Click Here To Download C++ File Of This Program
//prg to calc elec bill using if
//Downloaded From www.c4cpp.co.nr. (C)2009.All rights reserved.
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
float r,a,u;
cout<<"Enter Your Rn + Elec Bill"<<endl;
cin>>r>>u;
if(a<=100)
a=u*.40+50;
else
if((u>100) && (u<=300))
a=100*.40 + (u-100)*.50 + 50;
else
a=(100*.4 + 200*.50 + (u-300)*.60 + 50);
cout<<"Bill = "<<a;
getch();
}
Calculation
Click Here To Download C++ File Of This Program
//Read val x,y,z & display value of p = (w+x/0/(y-z)
//Downloaded From www.c4cpp.co.nr. (C)2009.All rights reserved.
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int w,x,y,z;
float p;
cout<<"Enter 4 numbers"<<endl;
cin>>x>>y>>z>>w;
p=(w+x)/(y-z);
cout<<"(w+x)/(y-z) = "<<p;
getch();
}
Triangle Area
Click Here To Download C++ File Of This Program
//prg to find area of triangle
//Downloaded From www.c4cpp.co.nr. (C)2009.All rights reserved.
#include<iostream.h>
#include<conio.h>
#include<math.h>
void main()
{
clrscr();
float a,b,c,p,ar;
cout<<"Enter 3 sides :"<<endl;
cin>>a>>b>>c;
p=a+b+c;
ar=sqrt(p*(p-a)*(p-b)*(p-c));
cout<<"Area :"<<ar;
getch();
}
Accept Radius & Produce Area
Click Here To Download C++ File Of This Program
//prg to accept radius and produce area
//Downloaded From www.c4cpp.co.nr. (C)2009.All rights reserved.
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
float r,ar;
cout<<"Enter radius"<<endl;
cin>>r;
ar =(22/7)*r*r;
cout<<"Area = "<<ar;
getch();
}
Subscribe to:
Posts (Atom)