Subscribe to Feeds

Send Your COMPLETED Projects To georgepj@hotmail.com

We'll Publish It With Your Name :-)

Programs Can Also Be Downloaded From The Folders Below....[Or Scroll Down]

Showing posts with label Class XI. Show all posts
Showing posts with label Class XI. Show all posts

Print n Prime Nos.

Click Here To Download C++ File Of This Program

 //Downloaded From www.c4cpp.co.nr  
//(C)2009.All rights reserved.
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int n=0,i,l,j,k=2,a=0;
cout<<"Enter Limit"<<endl;
cin>>l;
while(n<l)
{
j=2;
a=0;
while(j<=k/2)
{
if(k%j==0)
a=a+1;
j++;
}
if(a==0)
{
cout<<endl<<k<<endl;
}
else
l++;
n++;
k++;
}
getch();
}

No. of repetitions of a digit

Click Here To Download C++ File Of This Program

 //Downloaded From www.c4cpp.co.nr  
//(C)2009.All rights reserved.
#include<iostream.h>
#include<conio.h>
#include<string.h>
void main()
{
clrscr();
int i,j,c=1,l;
char a[100];
cout<<"Enter Array"<<endl;
cin.getline(a,100);
l=strlen(a);
for(i=0;i<l;i++)
{
c=1;
for(j=i+1;j<l;j++)
{
if(a[i]==a[j])
{
c=c+1;
a[j]=' ';
}
}
if(a[i]!=' ')
cout<<"Element"<<a[i]<<"is present"<<c<<"times"<<endl;
}
getch();
}

Array in given pattern

Click Here To Download C++ File Of This Program

 /*  
4 3 2 1
0 3 2 1
0 0 2 1
0 0 0 1
*/
//Downloaded From www.c4cpp.co.nr
//(C)2009.All rights reserved.
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int i,n,g,j,a[100],b[100][100];
cout<<"Enter Limit"<<endl;
cin>>n;
cout<<"Enter "<<endl;
for(g=0;g<n;g++)
cin>>a[g];
for(i=0;i<n;i++)
{
for(j=n-1;j>=0;j--)
{
b[i][j]=a[j];
}
}
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
if(i>j)
b[i][j]=0;
}
}
for(i=0;i<n;i++)
{
cout<<endl;
for(j=0;j<n;j++)
{
cout<<b[i][j]<<" ";
}
}
getch();
}

Predict Output 2

Click Here To Download C++ File Of This Program

 //Downloaded From www.c4cpp.co.nr  
//(C)2009.All rights reserved.
#include<iostream.h>
#include<conio.h>
#include<string.h>
#include<stdio.h>
#include<ctype.h>
void main()
{
clrscr();
char *Name="AnnUal ExaMiNaTION";
for(int x=0;x<strlen(Name);x++)
if(islower(Name[x]))
Name[x]=toupper(Name[x]);
else
if(isupper(Name[x]))
if(x%2!=0)
Name[x]=tolower(Name[x-1]);
else
Name[x]--;
cout<<Name<<endl;
getch();
}

Predict Output

Click Here To Download C++ File Of This Program

 //Downloaded From www.c4cpp.co.nr  
//(C)2009.All rights reserved.
#include<iostream.h>
#include<conio.h>
void main()
{clrscr();
int i=0,ua=0,ub=0,uc=0,fail=0;
while(i<=5)
{switch(i++)
{case 1:
case 2:++ua;
case 3:
case 4:++ub;
case 5:++uc;
default:++fail;
}
}
cout<<" ua="<<ua<<",ub="<<ub<<",uc="<<uc<<",fail="<<fail;
getch();
}

Calculator

Click Here To Download C++ File Of This Program

 //Downloaded From www.c4cpp.co.nr  
//(C)2009.All rights reserved.
#include<iostream.h>
#include<conio.h>
void main()
{
int a,b,s,op;
clrscr();
cout<<"\t\t\t\tCALCULATOR\n\t\t\tAll Rights Reserved\a\n";
cout<<"\t\tIllegal Copying is punishable\a\nEnter Number A\a :";
cin>>a;
cout<<"\nEnter Number B\a :";
cin>>b;
cout<<endl<<"\t\t1.Addition\n\t\t2.Subtraction\n\t\t";
cout<<"3.Division(Whole Numbers only)\n\t\t4.Multiplication\n\t\t";
cout<<"5.Square of A\n\t\t6.Square of B\n\t\t";
cout<<"7.'A'square - 'B'square\n\t\t8.'A'square + 'B'square\n\t\t";
cout<<"9.'A'square * 'B'square\n\t\t10.'A'square / 'B'square(whole numbers only";
cout<<"\n\t\t11.'A'cube\n\t\t12.'B'cube";
cout<<endl<<" Enter Choice\a :";
cin>>op;
switch(op)
{
case 1:s=a+b;
cout<<"Sum = \a"<<s;
break;
case 2:s=a-b;
cout<<"Difference =\a "<<s;
break;
case 3:s=a/b;
cout<<"Quotient =\a "<<s;
break;
case 4:s=a*b;
cout<<"Product =\a "<<s;
break;
case 5:s=a*a;
cout<<"Square =\a "<<s;
break;
case 6:s=b*b;
cout<<"Square =\a "<<s;
break;
case 7:s=(a*a)-(b*b);
cout<<"Answer =\a "<<s;
break;
case 8:s=(a*a)+(b*b);
cout<<"Answer =\a "<<s;
break;
case 9:s=(a*a)*(b*b);
cout<<"Answer =\a "<<s;
break;
case 10:s=(a*a)/(b*b);
cout<<"Answer =\a "<<s;
break;
case 11:s=a*a*a;
cout<<"Answer =\a "<<s;
break;
case 12:s=b*b*b;
cout<<"Answer =\a "<<s;
break;
default:cout<<"Invalid\a Choice\a";
}
getch();
}

Sum of Prime Nos

Click Here To Download C++ File Of This Program

 //Downloaded From www.c4cpp.co.nr. (C)2009.All rights reserved.  
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int p=0,i,n;
cout<<"Enter the no :"<<endl;
cin>>n;
for(i=2;i<=(n/2);i++)
{
if(n%i==0)
p=1;
}
if(p==0)
cout<<"Prime";
else if (p==1)
cout<<"Not Prime";
getch();
}

Sum of Odd +ve & -ve

Click Here To Download C++ File Of This Program

 // Sum of +ve -ve  
//Downloaded From www.c4cpp.co.nr. (C)2009.All rights reserved.
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int x,a,n=0,h,i,o=0,d=0;
cout<<"Enter no of nos u want to enter"<<endl;
cin>>h;
for(i=1;i<=h;i++)
{
cin>>a;
if((a>0)&& (a%2!=0))
{
o=o+a;}
if ((a<0) && (a%2!=0))
{n=n+a; }
}
cout<<"Sum of odd negative ="<<n<<endl<<"odd +ve ="<<o;
getch();
}

Odd Nos. in descending order

Click Here To Download C++ File Of This Program

 //prg to n odd nos in desc order  
//Downloaded From www.c4cpp.co.nr. (C)2009.All rights reserved.
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int i,n;
cout<<"Enter the no :"<<endl;
cin>>n;
if(n%2==0)
n=n-1;
for(i=n;i>=1;i=i-2)
cout<<i<<endl;
getch();
}

No. of Digits

Click Here To Download C++ File Of This Program

 //prg for no of digits  
//Downloaded From www.c4cpp.co.nr. (C)2009.All rights reserved.
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int s,n,i,d;
cout<<"Enter a number"<<endl;
cin>>n;
for(i=0;n>0;i++)
{
n=n/10;
}
cout<<i;
getch();
}

Greatest of 3 Nos.

Click Here To Download C++ File Of This Program

 //prg to find greatest of 3 nos  
//Downloaded From www.c4cpp.co.nr. (C)2009.All rights reserved.
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int a,b,c,bi;
cout<<"Enter 3 nos"<<endl;
cin>>a>>b>>c;
bi=a>b?(a>c?a:c):((b>c)?b:c);
cout<<"Greatest = "<<bi;
getch();
}

Simple & Compund Interest

Click Here To Download C++ File Of This Program

 //prg to compute SI and CI  
//Downloaded From www.c4cpp.co.nr. (C)2009.All rights reserved.
#include<iostream.h>
#include<conio.h>
#include<math.h>
void main()
{
clrscr();
float t,r,a,c,s,ci;
cout<<"Enter Principle :"<<endl;
cin>>a;
cout<<"Enter Time Period :"<<endl;
cin>>t;
cout<<"Enter Rate of Interest :"<<endl;
cin>>r;
s=(a*r*t)/100;
c= pow ((((r/100)+1)*a),t);
ci = (c-a);
cout<<"Simple Interest : "<<s<<"Compound Interest : "<<ci<<endl;
getch();
}

No Days, Weeks in a Year

Click Here To Download C++ File Of This Program

 //Downloaded From www.c4cpp.co.nr. (C)2009.All rights reserved.  
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int d,y,w,da;
cout<<"Enter the no of Days"<<endl;
cin>>d;
y=d/365;
w=((y%365)/7);
da=((y%365)%7);
cout<<y<<"Yrs "<<w<<"Weeks"<<da<<"Days";
getch();
}

Greatest of 3 Nos. using Conditional

Click Here To Download C++ File Of This Program

 //prg to find greatest using conditional  
//Downloaded From www.c4cpp.co.nr. (C)2009.All rights reserved.
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int a,b,by;
cout<<"Enter 2 nos"<<endl;
cin>>a>>b;
by=(a>b)?a:b;
cout<<"Greatest = "<<by;
getch();
}

Factorial

Click Here To Download C++ File Of This Program

 //prg to find factorial  
//Downloaded From www.c4cpp.co.nr. (C)2009.All rights reserved.
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int n,i,f=1;
cout<<"Enter a no n"<<endl;
cin>>n;
for(i=1;i<=n;i++)
f=f*i;
cout<<"Factorial ="<<f;
getch();
}

Insert & Delete from Array

Click Here To Download C++ File Of This Program

 //insert delete an element from array  
//Downloaded From www.c4cpp.co.nr. (C)2009.All rights reserved.
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int n,x,c=0,e,ch,i,a[50],j;
cout<<"Enter Array lim"<<endl;
cin>>n;
cout<<"Enter array"<<endl;
for(i=0;i<n;i++)
cin>>a[i];
cout<<"Enter Choice 1:Deletion 2Insertion"<<endl;
cin>>ch;
switch(ch)
{
case 1:
cout<<"Enter to be deleted"<<endl;
cin>>x;
for(i=0;i<n;i++)
{
if(a[i]==x)
{c++;
for(j=i;j<n;j++)
{
a[j]=a[j+1];
}
}
}
if(c==0)
cout<<"ENP"<<endl;
for(i=0;i<n-c;i++)
cout<<a[i]<<endl;
break;
case 2:
cout<<"Enter What & Where to be inserted"<<endl;
cin>>e>>x;
for(i=n;i>=x;i--)
a[i]=a[i-1];
a[x-1]=e;
for(i=0;i<=n;i++)
cout<<a[i]<<endl;
break;
}
getch();
}

Pascals Triangle & Pattern

Click Here To Download C++ File Of This Program

 //prg to display diamond and pascals triangle  
//Downloaded From www.c4cpp.co.nr. (C)2009.All rights reserved.
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int x,i,f,r,b,g,c,h,v=1,q,j,n,p,k=1;
int ch;
cout<<"Enter choice 1:STARS"<<endl;
cout<<" 2:NUMBERS"<<endl;
cin>>ch;
switch(ch)
{
//WITH STAR
case 1:
v=2;
char a2[100][100];
cout<<"Enter Limit : "<<endl;
cin>>n;
p=n-1;
//INPUTTING
for(i=0;i<=(2*n)-2;i++)
{
for(j=0;j<=(2*n)-2;j++)
{
a2[i][j]= ' ';
}
}
//STARTING
for(i=0;i<=(2*n)-2;i++)
{
for(j=0;j<=(2*n)-2;j++)
{
if(((i+j)==p)&&(i<n))
{
for(c=0;c<k;c++)
{
a2[i][j]='*';
j=j+v;
}
k++;
j=(2*n)-2;
r=c-1;
}
if(((i+j)==(p+2))&&(i>=n))
{
for(h=r;h>0;h--)
{
a2[i][j]='*';
j=j+v;
}
p=p+2;
r--;
j=(2*n)-2;
}
}
}
for(i=0;i<=(2*n)-2;i++)
{
cout<<endl;
for(j=0;j<=(2*n)-2;j++)
{
cout<<a2[i][j];
}
}
break;
//CASE TWO WITH NUMBERS
case 2:
int a[100][100];
cout<<"Enter Limit : "<<endl;
cin>>n;
p=n-1;
for(i=0;i<=(2*n)-2;i++)
{
for(j=0;j<=(2*n)-2;j++)
{
a[i][j]=0;
}
}
for(i=0;i<=(2*n)-2;i++)
{
for(j=0;j<=(2*n)-2;j++)
{
if(((i+j)==p)&&(i<n))
{
b=1;
for(c=0;c<k;c++)
{
if(j<=(n-1))
{
a[i][j]=b;
j=j+v;
b++;
r=b-2;
}
if(j>(n-1))
{
a[i][j]=r;
j=j+v;
r--;
}
}
k=k+2;
j=(2*n)-2;
r=c-2;
}
if(((i+j)==p+2)&&(i>=n))
{
f=1;
for(h=r;h>0;h--)
{
if(j<=(n-1))
{
a[i][j]=f;
j=j+v;
f++;
x=f-2;
}
if(j>(n-1))
{
a[i][j]=x;
j=j+v;
x--;
}
}
r=r-2;
p=p+2;
j=(2*n)-2;
}
}
}
for(i=0;i<=(2*n)-2;i++)
{
cout<<endl;
for(j=0;j<=(2*n)-2;j++)
{
if(a[i][j]!=0)
cout<<a[i][j];
else
cout<<" ";
}
}
break;
default:
cout<<"Wrong choice"<<endl;
break;
}
getch();
}

No. of Vowels, Characers in a String

Click Here To Download C++ File Of This Program

 //NO CHAR VOWELS IN A WORD  
//Downloaded From www.c4cpp.co.nr. (C)2009.All rights reserved.
#include<iostream.h>
#include<conio.h>
#include<ctype.h>
#include<stdio.h>
#include<string.h>
void main()
{
int i,j=0,l=0,u,v=0,s=0;
char st[50];
clrscr();
cout<<"Enter the string"<<endl;
gets(st);
l=strlen(st);
for(j=0;j<l;j++)
{
if((st[j]== ' '))
s=s+1;
if((st[j]=='a')||(st[j]=='e')||(st[j]=='o')||(st[j]=='i')||(st[j]=='u')||(st[j]=='A')||(st[j]=='E')||(st[j]=='O')||(st[j]=='I')||(st[j]=='U'))
v=v+1;
}
cout<<"No of Words = "<<s+1<<endl<<"No Space = "<<s<<endl<<"No of Vowels ="<<v<<endl<<"No of Characters ="<<l-s;
getch();
}

Decimal To Binary & vice versa

Click Here To Download C++ File Of This Program

 //prg to conv decimal to binary & binary to decimal 
//Downloaded From www.c4cpp.co.nr. (C)2009.All rights reserved.
#include<iostream.h>
#include<conio.h>
#include<math.h>
void main()
{
clrscr();
int a,g,h,s=0,i=0,d,b,ch;
cout<<endl<<"Enter the choice - "<<endl<<"1:Binary to Decimal"<<endl<<"2:Decimal to Binary"<<endl;
cin>>ch;
switch(ch)
{
case 1:
cout<<"Enter the Binary Digit"<<endl;
cin>>b;
while(b>0)
{
a=b%10;
s=s+a*(pow(2,i));
i=i+1;
b=b/10;
}
cout<<"Answer ="<<s<<endl;
break;
case 2:
cout<<"Enter the Decimal"<<endl;
cin>>d;
while(d>0)
{
a=d%2;
a=a*pow(10,i);
s=s+a;
i=i+1;
d=d/2;
}
cout<<"Answer ="<<s<<endl;
break;
default:
cout<<"Wrong choice"<<endl;
break;
}
getch();
}

No of Digits in a No.

Click Here To Download C++ File Of This Program

 //No of Digits in  a number 
//Downloaded From www.c4cpp.co.nr. (C)2009.All rights reserved.
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int x=0,n;
cout<<"Enter the number :";
cin>>n;
while(n>0)
{
n=n/10;
x=x+1;
}
cout<<"The no of digits are :"<<x;
getch();
}