HomeHome  SearchSearch  RegisterRegister  Log in  

Share | 
 

 Computer Science Record Programs Class 11 CBSE (2012)

View previous topic View next topic Go down 
AuthorMessage
Anupam (Administrator)
Admin
avatar

Posts : 117
Join date : 2012-02-25

PostSubject: Computer Science Record Programs Class 11 CBSE (2012)   Sat Jan 05, 2013 7:29 pm







These are Verified C++ Programs


SERIESU‎1-u+ u^2/2! + u^3/3!...

Quote :
#include<iostream.h>
#include<conio.h>
#include<math.h>
void main()
{
clrscr();
int fact (int);
float u,i,n,a,s=1;
cout<<"Enter valve of U: “;
cin>>u;
cout<<”Number of terms : ";
cin>>n;
for (i=1;i<n;++i)
{ a=fact(i);
s+=pow((-1),i)*pow(u,i)/a;
}
cout<<"Sum of the series : "<<s;
getch();
}
int fact (int x)
{ int f=1;
while (x>0)
{ f*=x;
--x;
}
return (f);
}




SERIESu1-u+ u^2/2! - u^3/3!...

Quote :
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int square (int);
int i,j,n,s=0;
cout<<"Enter number of terms : ";
cin>>n;
for(i=1; i<=n; ++i)
{ for(j=1; j<=i; ++j)
s+= square (2*j);
}
cout<<"Sum of the series : "<<s;
getch();
}
int square (int a)
{ int s;
s=a*a;
return (s);
}


ABCD

Quote :
#include <iostream.h>
#include <conio.h>
void main()
{
clrscr();
int n,i,x,y;
void ab(int);
void ba(int, int, int);
cout<< "Enter the number of lines : ";
cin>>n;
for (i=n,x=1,y=4;i>=1;i--,y++);
{
gotoxy(x,y);
ab(i);
}
for (i=n, x=2*n-1,y=4;i>=1;i--, x+=2, y++)
ba(i,x,y);
getch();
}
void ab(int a)
{
int i;
for (i=65; i<=64+a; i++)
cout<<char(i)<<" ";
}
void ba(int b,int x, int y)
{
int i;
gotoxy(x,y);
for (i=64+b;i>=65;i--)
cout<<char(i)<<" ";
}




ARMSTRONGNUMBER

Quote :
#include<iostream.h>
#include<conio.h>
#include<math.h>
void main()
{
clrscr();
int a,b,i,s=0;
int cube (int);
cout<<"Enter a no. : ";
cin>>a;
i=a;
while (a>0)
{
b=a%10;
a/=10;
s+= cube (b);
}
if (s==i)
cout<<"Armstrong no.";
else
cout<<"No";
getch();
}
int cube (int x)
{ int c;
c=pow(x,3);
return(c);
}



CHARACTERTYPE

Quote :

#include <iostream.h>
#include <conio.h>
#include <stdio.h>
void main()
{
clrscr();
void alnum(char); void dig(char);void lc(char);
void uc(char); void alpha(char);
cout <<"\n\n\n 1.Enter 1 for checking alphanumeric\n"
<<"2.Enter 2 for checking digit \n"
<<"3.Enter 3 for checking lowercase \n"
<<"4.Enter 4 for checking uppercase \n"
<<"5.Enter 5 for checking alphabet\n"
<<"6.Enter 6 for converting to lower case\n"
<<"7.Enter 7 for converting to uppercase \n"
<<"8.Enter 8 for checking whether space key has been entered \n";
int num,s; char ch; char ch1[1];
cin>>num;
switch(num)
{
case 1: cout<<"Enter a character : \n";
cin>>ch;alnum(ch); break;
case 2: cout <<"Enter a character: \n";
cin>>ch; dig(ch); break;
case 3: cout<<"Enter a character : \n";
cin>>ch;lc(ch);break;
case 4: cout<<"Enter a character :\n";
cin>>ch;uc(ch);break;
case 5: cout<<"Enter a character :\n";
cin>>ch;alpha(ch); break;
case 6: cout<<"Enter a character :\n";
cin>>ch; s=int(ch)+32;
cout<<char(s);break;
case 7: cout<<"Enter a character :\n";
cin>>ch; s=int(ch)-32;
cout<<char(s);break;
case 8: cout<<"Enter a character :\n";
gets(ch1);
if(ch1[0]==' ')
cout<<"A space has been entered. \n";
else
cout<<"No space is entered.";
break;
default: cout<<"Enter numbers only from 1 to 8. \n";
}
getch();
}
void alnum (char ch)
{ if((int (ch)>=48 && int(ch)<=57) ::
(int (ch)>=67 && int(ch)<=90) ::
(int (ch)>=97 && int(ch)<=122))
cout<<"The character is alphanumeric.";
}
void dig (char ch)
{ if(int(ch)>=48&&int(ch)<=57)
cout<<"The character is a digit.";
}
void lc (char ch)
{ if(int(ch)>=97&&int(ch)<=122)
cout<<"The alphabet is in lowercase.";
}
void uc (char ch)
{ if(int(ch)>=65&&int(ch)<=90)
cout<<"The alphabet is in upper case.";
}
void alpha (char ch)
{ if((int(ch)>=65&&int(ch)<=90)::(int(ch)>=97&&int(ch)<=122))
cout<<"The character is alphabet.";
}



DIAMOND

Quote :
#include<iostream.h>
#include<conio.h>
void main ()
{
clrscr();
int i,j,a,b,n;
cout<<"Enter number of lines : ";
cin>>n;
b=n;
for (i=1; i<=n; ++i)
{
for (a=1; a<=2*(b-1); ++a)
cout<<" ";
for (j=1; j<=(2*i)-1; ++j)
cout<<"*"<<" ";
cout<<"\n";
--b;
}
b=n-1;
for (i=1; i<n; ++i)
{
for (a=1; a<=2*i; ++a)
cout<<" ";
for (j=1; j<=(2*b)-1; ++j)
cout<<"*"<<" ";
cout<<"\n";
--b;
}
getch();
}


DIGITALCLOCK

Quote :
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int a,b,c,d,h,m,s;
cout<<"Enter number of hours, minutes, seconds : ";
cin>>a>>b>>c;
m=c/60+b;
h=m/60+a;
d=h/24;
h=h%24;
m=m%60;
s=s%60;
cout<<"Number of days : "<<d<<"\n";
cout<<"Number of hours : "<<h<<"\n";
cout<<"Number of minutes : "<<m<<"\n";
cout<<"Number of seconds : "<<s<<"\n";
getch();
}


ELECTRICITYBILL
Quote :

#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
float c,r;
cout<<"Enter unit consumption : ";
cin>>c;
if (c<=200)
{ r=c*0.5;
cout<<"Charge : "<<r;
}
if (c>200 && c<=400)
{ r=100;
r+=(c-200)*0.65+100;
cout<<"Charge : "<<r;
}
if (c>400 && c<=600)
{ r=330;
r+=(c-400)*0.8+200;
cout<<"Charge : "<<r;
}
if (c>600)
{ r=690;
r+=(c-600)*1.2+300;
cout<<"Charge : "<<r;
}
getch();
}


FLOYD'STRIANGLE

Quote :
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int i,j,n,a=1;
cout<<"Enter number of lines : ";
cin>>n;
for (i=1; i<=n; ++i)
{ for (j=1; j<=i; ++j)
{ cout<<a<<" ";
++a;
}
cout<<"\n";
}
getch();
}


KRISHNAMOORTHYNUMBER

Quote :
#include<iostream.h>
#include<conio.h>
void main ()
{
clrscr();
int fact (int);
unsigned long i,a,b,s=0;
cout<<"Enter a number : ";
cin>>a;
i=a;
while(a>0)
{ b=a%10;
a=a/10;
s+= fact (b);
}
if(s==i)
cout<<"\n"<<"Yes, it is a Krishnamoorthy's no.";
else
cout<<"\n"<<"No.";
getch();
}
int fact (int x)
{ int f=1;
while (x)
{
f*=x;
--x;
}
return (f);
}


PALINDROMEDETECTOR

Quote :
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
long int a,i,d,s=0;
cout<<"Enter no. : ";
cin>>a;
i=a;
while (a)
{ d=a%10;
a/=10;
s=s*10+d;
}
if (i==s)
cout<<"Palindrome.";
else
cout<<"No";
getch();
}


PASCAL'STRIANGLE


Quote :
#include <iostream.h>
#include <conio.h>
void main()
{
int n,i,j,x,k,a,b;
clrscr();
cout<< "enter n:";
cin>> n;
b=n;
for (i=0;i<=n;i++)
{
for (a=1;a<=b*2;a++)
cout<<" ";
x=1;
for (k=0; k<=i; k++)
{
cout<<x<<" ";
x=x*(i-k)/(k+1);
}
cout<<"\n";
--b;
}
getch();
}


PRIMENUMBERDETECTOR

Quote :
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr ();
long b,a=2,i=1,n=0;
cout<<" Enter number : ";
cin>>b;
while ( a<=b )
{
n=0;
i=1;
while (i<=(a/2))
{
if ( a%i==0 )
n++;
i++;
}
if ( n==1 )
cout<<"\t"<<a;
a++;
}
getch();
}

ROOTSOFQUADRATICEQUATION

Quote :
#include<iostream.h>
#include<conio.h>
#include<math.h>
void main()
{
clrscr();
float a,b,c,d,r1,r2;
cout<<"Enter coeft a,b,c : ";
cin>>a>>b>>c;
d=pow(b,2)-(4*a*c);
if (d>=0)
{
r1=(-(b)+(pow(d,0.5)))/(2*a);
r2=(-(b)-(pow(d,0.5)))/(2*a);
cout<<"Root r1 : "<<r1<<"\t"<<"Root r2 : "<<r2;
}
else
cout<<"Roots are imaginary.";
getch();
}

_______________________________________________________________________________________________________________________________________________________________________





OUTPUTS OF ALL THESE PROGRAMS





Enter a natural number : 145
Yes ,it is an Krishnamoorthy’s number.



Enter the number of terms : 3
The sum is: 80



Enter u and the number of terms : 2 3
The sum is : 1



Enter the number of lines : 5
A B C D E D C B A
A B C D __ D C B A
A B C ______ C B A
A B___________ B A
A_______________ A




Enter the number of lines(an odd number) : 4
*
* * *
* * * * *
* * * * * * *
* * * * *
* * *
*




Enter the no. of seconds : 86400
Number of days : 1
Number of hours : 0
Number of minutes : 0
Number of seconds : 0



Enter 1 for checking alphanumeric
Enter 2 for checking digit
Enter 3 for checking lowercase
Enter 4 for checking uppercase
Enter 5 for checking alphabet
Enter 6 for converting to lowercase
Enter 7 for converting to uppercase
Enter 8 for checking whether space key has been entered

Enter a number : 6
Enter alphabet in uppercase : D
Lower case : d



Enter coefficient of x^2 ,x and constant term : 1 -3 2
Roots are 1 and 2



Enter unit consumption : 300
Charge : Rs. 150

Enter a number : 15
2 3 5 7 11 13




Enter a number : 454
Yes , Palindrome.



Enter number of lines : 4

1
2 3
4 5 6
7 8 9 10



Enter number of lines : 4
____________1
__________1 2 1
_________1 3 3 1
________1 4 6 4 1



Enter a number : 153
Yes it is an Armstrong number.











SUPPORT :--
A SIMPLE 'THANKS' WILL DO !!!


MilanStopper - Best Hangout Place !
MilanStopper - Best Hangout Place !
MilanStopper - Best Hangout Place !
MilanStopper - Best Hangout Place !





Back to top Go down
View user profile http://milanstopper.fullboards.com
 
Computer Science Record Programs Class 11 CBSE (2012)
View previous topic View next topic Back to top 
Page 1 of 1
 Similar topics
-
» My new Class Cards.
» 2012 (working title) - Work In Progress
» WHO DO YOU THINK WILL WIN PRESIDENTIAL RACE IN 2012
» New Ebook "2012 and Beyond"
» RCA's Record Player Lineup for 1958

Permissions in this forum:You cannot reply to topics in this forum
 :: PUBLIC :: C++ TUTORIALS-
Jump to: