Professional Documents
Culture Documents
CS Project Work
CS Project Work
Project Work
My Software
This Software is made by Dhananjay Kumar of Class 11th Science under the Guidelines of Mr. Ravi Kant
Sir (Computer Science, P.G.T.).
Made By. Dhananjay Kumar
Class. 11th Science
Computer Science
Project Work
My Software
Contents
Program Coding
1. Arithmetic Operator
Related
This Software Is User Friendly and Easy to be Upgradeable at Any Time.
My Software Coding
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
char ch;
cout<<" *---------------------------------------------* #-----------------------------------------------#"<<endl;
cout<<" |
Contents
| | 1.Arithmetic Operators.
|"<<endl;
cout<<" | 1. Arithmetic Operator Related | | 1.1 Addition (+)
|"<<endl;
cout<<" | 2. Even and Odd Number Related | | 1.2 Substraction (-)
|"<<endl;
cout<<" | 3. Function Related
| | 1.3 Multiplication (*)
|"<<endl;
cout<<" | 4. Array Related
| | 1.4 Division (/)
|"<<endl;
cout<<" |
| | 1.5 Calculator (+,-,*,/) & More.. |"<<endl;
cout<<" *---------------------------------------------* #-----------------------------------------------#"<<endl;
cout<<"
@----------------------------------------------------@"<<endl;
cout<<"
| 2.Even and Odd Number
|"<<endl;
cout<<"
| 2.1 Even Odd Number
|"<<endl;
cout<<"
| 2.2 Sum of Even Odd Number & More...|"<<endl;
cout<<"
@----------------------------------------------------@"<<endl;
cout<<" !------------------------------------------------! %-------------------------------------------%"<<endl;
cout<< | 3.Functions
| | 4.Array
|"<<endl;
cout<< | 3.1 Factorial Of Given Number
| | 4.1 Single Dimensional Array |"<<endl;
cout<< | 3.2 Fibonacci Series
| | 4.2 Double Dimensional Array |"<<endl;
cout<< | 3.3 Sum of Even And Odd Number | |
|"<<endl;
cout<<" | 3.4 Prime Number & More.....
||
|"<<endl;
cout<<" !------------------------------------------------! %--------------------------------------------%"<<endl;
cout<<endl;
cout<<"Enter Your Choice "<<endl;
cout<<"=> ";
cin>>ch;
if(ch=='1')
{
clrscr();
cout<<"
Choices are as Follow "<<endl;
cout<<"
#--------------------------------------------------------------------------------------#"<<endl;
cout<<"
|
>>
Arithmetic Operators.
<<
|"<<endl;
cout<<"
| 1. Simple Calculation Programs
|"<<endl;
cout<<"
|
1.1.1 Addition (+)
|"<<endl;
cout<<"
|
1.1.2 Substraction (-)
|"<<endl;
cout<<"
|
1.1.3 Multiplication (*)
|"<<endl;
cout<<"
|
1.1.4 Division (/)
|"<<endl;
cout<<"
|
1.1.5 Calculator (+,-,*,/)
|"<<endl;
cout<<"
| 2. Leap Year Program
|"<<endl;
cout<<"
| 3. Maximum Number
|"<<endl;
cout<<"
| 4. Pallindrome Number
|"<<endl;
cout<<"
| 5. Reverse Number
|"<<endl;
cout<<"
| 6. Prime Number
|"<<endl;
cout<<"
| 7. Square Root of A Number
|"<<endl;
cout<<"
| 8. Square and Cube of A Number
|"<<endl;
cout<<"
#--------------------------------------------------------------------------------------#"<<endl;
cout<<endl;
char ch;
cout<<"Please Enter Your Choice Only Which is Given to You"<<endl;
cout<<"=> ";
cin>>ch;
if(ch=='1')
{
clrscr();
cout<<"
@-----------------------------------------------------------------------------------@"<<endl;
cout<<"
|
1. Simple Calculation Programs
|"<<endl;
cout<<"
|
A. Addition (+)
|"<<endl;
cout<<"
|
B. Substraction (-)
|"<<endl;
cout<<"
|
C. Multiplication (*)
|"<<endl;
cout<<"
|
D. Division (/)
|"<<endl;
cout<<"
|
E. Calculator (+,-,*,/)
|"<<endl;
cout<<"
@-----------------------------------------------------------------------------------@"<<endl;
cout<<endl;
char ch;
cout<<"Please Enter Your Choice Only Which is Given to You "<<endl;
cout<<"=> ";
cin>>ch;
clrscr();
switch(ch)
{
case 'A': cout<<"Program for Addition"<<endl;
cout<<endl;
cout<<"#include<iostream.h>"<<endl;
cout<<"#include<conio.h>"<<endl;
cout<<"void main()"<<endl;
cout<<"{"<<endl;
cout<<" clrscr();"<<endl;
cout<<" int a,b,c;"<<endl;
cout<<" cout<<\"Enter first number\"<<endl;"<<endl;
cout<<" cin>>a;"<<endl;
cout<<" cout<<\"Enter second number\"<<endl;"<<endl;
cout<<" cin>>b;"<<endl;
cout<<" c=a+b;"<<endl;
cout<<" cout<<\"Sum of the digits is\"<<c;"<<endl;
cout<<" getch();"<<endl;
cout<<"}"<<endl;
char ch;
cout<<endl;
cout<<"Are You Want to Use This Program if Yes Then Enter 'Y' otherwise 'N' "<<endl;
cout<<"=> ";
cin>>ch;
cout<<endl;
if(ch=='Y'||ch=='y')
{
int a,b,c;
cout<<"Enter First number: "<<endl;
cout<<"=>";
cin>>a;
cout<<"Enter Second number: "<<endl;
cout<<"=> ";
cin>>b;
c=a+b;
cout<<"Sum of the digits is:=> "<<c;
}
else
{
cout<<"Thank You For Using This Software"<<endl;
}
break;
case 'B': cout<<"Program for Subtraction"<<endl;
cout<<endl;
cout<<"#include<iostream.h>"<<endl;
cout<<"#include<conio.h>"<<endl;
cout<<"void main()"<<endl;
cout<<"{"<<endl;
cout<<" clrscr();"<<endl;
cout<<" int a,b,c;"<<endl;
cout<<" cout<<\"Enter first number\"<<endl;"<<endl;
cout<<" cin>>a;"<<endl;
cout<<" cout<<\"Enter second number\"<<endl;"<<endl;
cout<<" cin>>b;"<<endl;
cout<<" c=a-b;"<<endl;
cout<<" cout<<\"Subtraction of the digits is\"<<c;"<<endl;
cout<<" getch();"<<endl;
cout<<"}"<<endl;
char ch1;
cout<<endl;
cout<<"Are You Want to Use This Program if Yes Then Enter 'Y' otherwise 'N' "<<endl;
cout<<"=> ";
cin>>ch1;
cout<<endl;
if(ch1=='Y'||ch1=='y')
{
int a,b,c;
cout<<"Enter First number: "<<endl;
cout<<"=> ";
cin>>a;
cout<<"Enter Second number: "<<endl;
cout<<"=> ";
cin>>b;
c=a-b;
cout<<"Subtraction of the digits is:=> "<<c;
}
else
{
cout<<"Thank You For Using This Software"<<endl;
}
break;
case 'C': cout<<"Program for Multiplication"<<endl;
cout<<endl;
cout<<"#include<iostream.h>"<<endl;
cout<<"#include<conio.h>"<<endl;
cout<<"void main()"<<endl;
cout<<"{"<<endl;
cout<<" clrscr();"<<endl;
cout<<" int a,b,c;"<<endl;
cout<<" cout<<\"Enter first number\"<<endl;"<<endl;
cout<<" cin>>a;"<<endl;
cout<<" cout<<\"Enter second number\"<<endl;"<<endl;
cout<<" cin>>b;"<<endl;
cout<<" c=a*b;"<<endl;
cout<<" cout<<\"Multiplication of the digits is\"<<c;"<<endl;
cout<<" getch();"<<endl;
cout<<"}"<<endl;
char ch2;
cout<<endl;
cout<<"Are You Want to Use This Program if Yes Then Enter 'Y' otherwise 'N' "<<endl;
cout<<"=> ";
cin>>ch2;
cout<<endl;
if(ch2=='Y'||ch2=='y')
{
int a,b,c;
cout<<"Enter First number: "<<endl;
cout<<"=> ";
cin>>a;
cout<<"Enter Second number: "<<endl;
cout<<"=> ";
cin>>b;
c=a*b;
cout<<"Multiplication of the digits is:=> "<<c;
}
else
{
cout<<"Thank You For Using This Software"<<endl;
}
break;
case 'D': cout<<"Program for Division"<<endl;
cout<<endl;
cout<<"#include<iostream.h>"<<endl;
cout<<"#include<conio.h>"<<endl;
cout<<"void main()"<<endl;
cout<<"{"<<endl;
cout<<" clrscr();"<<endl;
cout<<" int a,b,c;"<<endl;
cout<<" cout<<\"Enter first number\"<<endl;"<<endl;
cout<<" cin>>a;"<<endl;
cout<<" cout<<\"Enter second number\"<<endl;"<<endl;
cout<<" cin>>b;"<<endl;
cout<<" c=a/b;"<<endl;
cout<<" cout<<\"Division of the digits is\"<<c;"<<endl;
cout<<" getch();"<<endl;
cout<<"}"<<endl;
char ch3;
cout<<endl;
cout<<"Are You Want to Use This Program if Yes Then Enter 'Y' otherwise 'N' "<<endl;
cout<<"=> ";
cin>>ch3;
cout<<endl;
if(ch3=='Y'||ch3=='y')
{
int a,b,c;
cout<<"Enter First number: "<<endl;
cout<<"=> ";
cin>>a;
cout<<"Enter Second number: "<<endl;
cout<<"=> ";
cin>>b;
c=a/b;
cout<<"Division of the digits is:=> "<<c;
}
else
{
cout<<"Thank You For Using This Software"<<endl;
}
break;
case 'E': cout<<" Program For Arithmetic Calculator
|switch(ch)"<<endl;
cout<<"#include<iostream.h>
|{"<<endl;
cout<<"#include<conio.h>
|case 'A':int c;"<<endl;
cout<<"void main()
| c=a+b;"<<endl;
cout<<"{
| cout<<\"Addition is:\"<<c;"<<endl;
cout<<" clrscr();
| break;"<<endl;
cout<<" char ch;
|case 'B':int d;"<<endl;
cout<<"
Choose Your Operator
| d=a-b;"<<endl;
cout<<" @--------------------------------------------------@
| cout<<\"Subtraction is\":<<d;"<<endl;
cout<<"
| 1. Simple Calculation Programs
|
| break;"<<endl;
cout<<"
| A. Addition (+)
|
|case 'C':int e;"<<endl;
cout<<"
| B. Substraction (-)
|
| e=a*b;"<<endl;
cout<<"
| C. Multiplication (*)
|
| cout<<\"Multiplication is:\"<<e;"<<endl;
cout<<"
| D. Division (/)
|
| break;"<<endl;
cout<<" @---------------------------------------------------@
|case 'D':int f;"<<endl;
cout<<"cout<<\"Enter Your Choice Given to You\"<<endl;
| f=a/b;"<<endl;
cout<<"cin>>ch;
| cout<<\"Division is:\"<<f;"<<endl;
cout<<"int a,b;
| break;"<<endl;
cout<<"cout<<\"Enter First Number\"<<endl;
|default: cout<<\"Wrong Input\";"<<endl;
cout<<"cin>>a;
|}"<<endl;
cout<<"cout<<\"Enter Second Number\"<<endl;
|getch(); "<<endl;
cout<<"cin>>b;
|}"<<endl;
char ch4;
cout<<"Are You Want to Use This Program if Yes Then Enter 'Y' otherwise 'N' "<<endl;
cout<<"=> ";
cin>>ch4;
if(ch4=='Y'||ch4=='y')
{
clrscr();
char ch;
cout<<"
Choose Your Operator
"<<endl;
cout<<"
@--------------------------------------------------------------@ "<<endl;
cout<<"
| 1. Simple Calculation Programs
| "<<endl;
cout<<"
| A. Addition (+)
| "<<endl;
cout<<"
| B. Substraction (-)
| "<<endl;
cout<<"
| C. Multiplication (*)
| "<<endl;
cout<<"
| D. Division (/)
| "<<endl;
cout<<"
@---------------------------------------------------------------@ "<<endl;
cout<<endl;
cout<<"Enter Your Choice Only Which is Given to You"<<endl;
cout<<"=> ";
cin>>ch;
if(ch=='a'||ch=='A')
{
cout<<endl;
cout<<"Addition"<<endl;
cout<<endl;
int a,b,c;
cout<<"Enter First Number"<<endl;
cout<<"=> ";
cin>>a;
cout<<"Enter Second Number"<<endl;
cout<<"=> ";
cin>>b;
c=a+b;
cout<<"Addition of Two Numbers is"<<endl;
cout<<"=> ";
cout<<c;
}
else if(ch=='b'||ch=='B')
{
cout<<endl;
cout<<"Substraction"<<endl;
cout<<endl;
int a,b,c;
cout<<"Enter First Number"<<endl;
cout<<"=> ";
cin>>a;
cout<<"Enter Second Number"<<endl;
cout<<"=> ";
cin>>b;
c=a-b;
cout<<"Substraction of Two Numbers is"<<endl;
cout<<"=> ";
cout<<c;
}
else if(ch=='c'||ch=='C')
{
cout<<endl;
cout<<"Multiplication"<<endl;
cout<<endl;
int a,b,c;
cout<<"Enter First Number"<<endl;
cout<<"=> ";
cin>>a;
cout<<"Enter Second Number"<<endl;
cout<<"=> ";
cin>>b;
c=a*b;
cout<<"Multiplication of Two Numbers is"<<endl;
cout<<"=> ";
cout<<c;
}
else if(ch=='d'||ch=='D')
{
cout<<endl;
cout<<"Division"<<endl;
cout<<endl;
int a,b,c;
cout<<"Enter First Number"<<endl;
cout<<"=> ";
cin>>a;
cout<<"Enter Second Number"<<endl;
cout<<"=> ";
cin>>b;
c=a/b;
10
cin>>b;
cout<<"Enter Third Numbers: "<<endl;
cout<<"=> ";
cin>>c;
if(a>b)
{
d=a;
}
else
{
d=b;
}
if(c>d)
{
cout<<"Maximum Number is:=> "<<c;
}
else
{
cout<<"Maximum Number is:=> "<<d;
}
}
else
{
cout<<"Thank You For Using This Software"<<endl;
}
}
else if(ch=='4')
{
clrscr();
cout<<"Program For Pallindrome Number"<<endl;
cout<<"#include<iostream.h>"<<endl;
cout<<"#include<conio.h>"<<endl;
cout<<"void main()"<<endl;
cout<<"{ clrscr();"<<endl;
cout<<" int a;"<<endl;
cout<<" cout<<\" Enter a three digit number:\" <<endl;"<<endl;
cout<<" cin>>a;"<<endl;
cout<<" int c=a;"<<endl;
cout<<" int rev=0;"<<endl;
cout<<" while(a>0)"<<endl;
cout<<" { int d=a%10;"<<endl;
cout<<" rev=(rev*10)+d;"<<endl;
cout<<" a=a/10; }"<<endl;
cout<<" if(c==rev)"<<endl;
cout<<" { cout<<\"It's a Palindrome\"<<endl;"<<endl;
cout<<" }"<<endl;
cout<<" else"<<endl;
cout<<" { cout<<\"It's not a Palindrome\"<<endl;"<<endl;
cout<<" }"<<endl;
11
12
cout<<" getch();"<<endl;
cout<<"}"<<endl;
cout<<endl;
char ch;
cout<<"Are You Want to Use This Program if Yes Then Enter 'Y' otherwise 'N' "<<endl;
cout<<"=> ";
cin>>ch;
if(ch=='y'||ch=='Y')
{
clrscr();
long int a;
cout<<"Enter a Digital Number: "<<endl;
cout<<"=> ";
cin>>a;
int c=a;
int rev=0;
while(a>0)
{
int d=a%10;
rev=(rev*10)+d;
a=a/10;
}
if(c==rev)
{
cout<<"It's a Palindrome"<<endl;
}
else
{
cout<<"It's not a Palindrome"<<endl;
}
}
else
{
cout<<"Thank You For Using This Software"<<endl;
}
}
else if(ch=='5')
{
clrscr();
cout<<"Program For Reverse of a Number"<<endl;
cout<<"#include<iostream.h>"<<endl;
cout<<"#include<conio.h>"<<endl;
cout<<"void main()"<<endl;
cout<<"{"<<endl;
cout<<" clrscr();"<<endl;
cout<<" int a;"<<endl;
cout<<" cout<<\"Enter a number:\" <<endl; ";
cout<<" cin>>a;"<<endl;
cout<<" int rev=0;"<<endl;
cout<<" while(a>0)"<<endl;
cout<<" {"<<endl;
cout<<" int d=a%10;"<<endl;
cout<<" rev=(rev*10)+d;"<<endl;
cout<<" a=a/10;"<<endl;
cout<<" }"<<endl;
cout<<" cout<<\"Reverse of the Number is:\"<<rev;"<<endl;
cout<<" getch();"<<endl;
cout<<"}"<<endl;
cout<<endl;
char ch;
cout<<"Are You Want to Use This Program if Yes Then Enter 'Y' otherwise 'N' "<<endl;
cout<<"=> ";
cin>>ch;
if(ch=='y'||ch=='Y')
{
clrscr();
int a;
cout<<"Enter a Number: "<<endl;
cout<<"=> ";
cin>>a;
int rev=0;
while(a>0)
{
int d=a%10;
rev=(rev*10)+d;
a=a/10;
}
cout<<"Reverse of the number is: "<<rev;
}
else
{
cout<<"Thank You For Using This Software"<<endl;
}
}
else if(ch=='6')
{
clrscr();
cout<<"Program For Prime Number"<<endl;
cout<<"#include<iostream.h>"<<endl;
cout<<"#include<conio.h>"<<endl;
cout<<"void main()"<<endl;
cout<<"{ clrscr();"<<endl;
cout<<" int a;"<<endl;
cout<<" cout<<\"Enter a Number\"<<endl;"<<endl;
cout<<" cin>>a;"<<endl;
cout<<" int b=0;"<<endl;
cout<<" for(int i=2;i<a;i++) "<<endl;
cout<<" { if(a%i==0)"<<endl;
13
14
cout<<" { b=1;"<<endl;
cout<<" break; }"<<endl;
cout<<" }"<<endl;
cout<<" if(b==1)"<<endl;
cout<<" { cout<<\"Not Prime\"<<endl;"<<endl;
cout<<" }"<<endl;
cout<<" else"<<endl;
cout<<" { cout<<\"Prime\"<<endl;"<<endl;
cout<<" } getch();"<<endl;
cout<<"}"<<endl;
cout<<endl;
char ch;
cout<<"Are You Want to Use This Program if Yes Then Enter 'Y' otherwise 'N' "<<endl;
cout<<"=> ";
cin>>ch;
if(ch=='y'||ch=='Y')
{
clrscr();
int a;
cout<<"Enter a Number"<<endl;
cout<<"=> ";
cin>>a;
int b=0;
for(int i=2;i<a;i++)
{
if(a%i==0)
{
b=1;
break;
}
}
if(b==1)
{
cout<<"Not a Prime Number"<<endl;
}
else
{
cout<<"Prime Number"<<endl;
}
}
else
{
cout<<"Thank You For Using This Software"<<endl;
}
}
else if(ch=='7')
{
clrscr();
cout<<"Program for Square Root Of A Number"<<endl;
cout<<"#include<iostream.h>"<<endl;
cout<<"#include<conio.h>"<<endl;
cout<<"#include<math.h>"<<endl;
cout<<"void main()"<<endl;
cout<<"{"<<endl;
cout<<" clrscr();"<<endl;
cout<<" int a;"<<endl;
cout<<" cout<<\"Enter a number\"<<endl; "<<endl;
cout<<" cin>>a;"<<endl;
cout<<" cout<<\"Square root of the number is:\"<<sqrt(a)<<endl;"<<endl;
cout<<" getch();"<<endl;
cout<<"}"<<endl;
cout<<endl;
char ch;
cout<<"Are You Want to Use This Program if Yes Then Enter 'Y' otherwise 'N' "<<endl;
cout<<"=> ";
cin>>ch;
if(ch=='y'||ch=='Y')
{
clrscr();
int a;
cout<<"Enter a number "<<endl;
cout<<"=> ";
cin>>a;
cout<<"Square root of the number is:=> "<<a*a<<endl;
}
else
{
cout<<"Thank You For Using This Software"<<endl;
}
}
else if(ch=='8')
{
clrscr();
cout<<"Program for Square and Cube of a Number"<<endl;
cout<<"#include<iostream.h>"<<endl;
cout<<"#include<conio.h>"<<endl;
cout<<"#include<math.h>"<<endl;
cout<<"void main()"<<endl;
cout<<"{"<<endl;
cout<<" clrscr();"<<endl;
cout<<" float a,b,c;"<<endl;
cout<<" cout<<\"Enter a number\"<<endl;"<<endl;
cout<<" cin>>a;"<<endl;
cout<<" b=pow(a,2);"<<endl;
cout<<" cout<<\"Square of the number is:\"<<b<<endl;"<<endl;
cout<<" c=pow(a,3);"<<endl;
cout<<" cout<<\"Cube of the number is:\" <<c<<endl;"<<endl;
cout<<" getch();"<<endl;
15
16
cout<<"}"<<endl;
cout<<endl;
char ch;
cout<<"Are You Want to Use This Program if Yes Then Enter 'Y' otherwise 'N' "<<endl;
cout<<"=> ";
cin>>ch;
if(ch=='y'||ch=='Y')
{
clrscr();
float a,b,c;
cout<<"Enter a number "<<endl;
cout<<"=> ";
cin>>a;
b=a*a;
cout<<"Square Of the Number is:=> "<<b<<endl;
c=a*a*a;
cout<<"Cube Of the Number is:=> "<<c<<endl;
}
}
else
{
cout<<"Thank You For Using This Software"<<endl;
}
}
else if(ch=='2')
{
clrscr();
cout<<"
Choices are as Follow
"<<endl;
cout<<"
@------------------------------------------------------------------@"<<endl;
cout<<"
| >> Different Operation of Number <<
|"<<endl;
cout<<"
| 1. Even Odd Number
|"<<endl;
cout<<"
| 1.1 To Find Even Odd Number
|"<<endl;
cout<<"
| 1.1 Sum of Even Odd Number
|"<<endl;
cout<<"
| 2. Factorial of A Number
|"<<endl;
cout<<"
| 3. Fibonnacci Series
|"<<endl;
cout<<"
@------------------------------------------------------------------@"<<endl;
cout<<endl;
char ch;
cout<<"Enter Your Choice"<<endl;
cout<<"=> ";
cin>>ch;
if(ch=='1')
{
clrscr();
cout<<"
@----------------------------------------------------------------@"<<endl;
cout<<"
| 1. Even Odd Number
|"<<endl;
cout<<"
| A. To Find Even Odd Number
|"<<endl;
cout<<"
| B. Sum of Even Odd Number
|"<<endl;
cout<<"
@-----------------------------------------------------------------@"<<endl;
cout<<endl;
char ch;
cout<<"Enter Your Choice Only Which is Given To You"<<endl;
cout<<"=> ";
cin>>ch;
if(ch=='A'||ch=='a')
{
clrscr();
cout<<"Program to Find Out Even and Odd Number " <<endl;
cout<<"#include<iostream.h>"<<endl;
cout<<"#include<conio.h>"<<endl;
cout<<"void main()"<<endl;
cout<<"{"<<endl;
cout<<" clrscr();"<<endl;
cout<<" int a;"<<endl;
cout<<" cout<<\"Enter a number.\"<<endl;"<<endl;
cout<<" cin>>a;"<<endl;
cout<<" if(a%2==0)"<<endl;
cout<<" { cout<<\"It is an Even number.\"<<endl;"<<endl;
cout<<" }"<<endl;
cout<<" else"<<endl;
cout<<" { cout<<\"It is an Odd number.\"<<endl;"<<endl;
cout<<" }"<<endl;
cout<<" getch();"<<endl;
cout<<"}"<<endl;
cout<<endl;
char ch;
cout<<"Are You Want to Use This Program if Yes Then Enter 'Y' otherwise 'N' "<<endl;
cout<<"=> ";
cin>>ch;
if(ch=='y'||ch=='Y')
{
clrscr();
int a;
cout<<"Enter a number."<<endl;
cout<<"=> ";
cin>>a;
if(a%2==0)
{
cout<<"It is an Even Number."<<endl;
}
else
{
cout<<"It is an Odd Number."<<endl;
}
}
else
{
cout<<"Thank You For Using This Software"<<endl;
17
18
}
}
else if(ch=='B'||ch=='b')
{
clrscr();
cout<<"Program For Sum of Even And Odd Number"<<endl;
cout<<"#include<iostream.h>"<<endl;
cout<<"#include<conio.h>"<<endl;
cout<<"void main()"<<endl;
cout<<"{"<<endl;
cout<<" clrscr();"<<endl;
cout<<" int sumeven=0,sumodd=0;"<<endl;
cout<<" int n;"<<endl;
cout<<" cout<<\"Enter Number Where You Want to Stop Loop\"<<endl;"<<endl;
cout<<" cin>>n;"<<endl;
cout<<" for(int i=0;i<n;i++)"<<endl;
cout<<" { if(i%2==0) "<<endl;
cout<<" { sumeven=sumeven+i;"<<endl;
cout<<" }"<<endl;
cout<<" else"<<endl;
cout<<" { sumodd=sumodd+i;"<<endl;
cout<<" }"<<endl;
cout<<" }"<<endl;
cout<<"cout<<\"Sum of the Even Elements is:\"<<sumeven<<endl;"<<endl;
cout<<"cout<<\"Sum of the Odd Elements is:\"<<sumodd<<endl;"<<endl;
cout<<"getch();"<<endl;
cout<<"}"<<endl;
char ch;
cout<<"Are You Want to Use This Program if Yes Then Enter 'Y' otherwise 'N' "<<endl;
cout<<"=> ";
cin>>ch;
if(ch=='y'||ch=='Y')
{
clrscr();
int sumeven=0,sumodd=0;
int n;
cout<<"Enter Number Where You Want to Stop Loop"<<endl;
cout<<"=> ";
cin>>n;
for(int i=0;i<=n;i++)
{
if(i%2==0)
{
sumeven=sumeven+i;
}
else
{
sumodd=sumodd+i;
}
}
cout<<"Sum of the Even Elements is:=> "<<sumeven<<endl;
cout<<"Sum of the Odd Elements is:=> "<<sumodd<<endl;
}
}
else
{
cout<<"Thank You For Using This Software"<<endl;
}
}
else if(ch=='2')
{
clrscr();
cout<<"Program For Factorial Of A Given Number"<<endl;
cout<<"#include<iostream.h>"<<endl;
cout<<"#include<conio.h>"<<endl;
cout<<"void main()"<<endl;
cout<<"{"<<endl;
cout<<" clrscr();"<<endl;
cout<<" int a,fact=1;"<<endl;
cout<<" cout<<\"Enter the Number You Want Factorial\"<<endl;"<<endl;
cout<<" cin>>a;"<<endl;
cout<<" for(int i=a;i>1;i--)"<<endl;
cout<<" {"<<endl;
cout<<" fact=fact*i;"<<endl;
cout<<" }"<<endl;
cout<<" cout<<\"Factorial of the given number is:\"<<fact;"<<endl;
cout<<" getch();"<<endl;
cout<<"}"<<endl;
char ch;
cout<<"Are You Want to Use This Program if Yes Then Enter 'Y' otherwise 'N' "<<endl;
cout<<"=> ";
cin>>ch;
if(ch=='y'||ch=='Y')
{
clrscr();
int a,fact=1;
cout<<"Enter The Number You Want Factorial "<<endl;
cout<<"=> ";
cin>>a;
for(int i=a;i>1;i--)
{
fact=fact*i;
}
cout<<"Factorial of the Given Number is "<<endl;
cout<<"=> ";
cout<<fact;
}
else
19
20
{
cout<<"Thank You For Using This Software"<<endl;
}
}
else if(ch=='3')
{
clrscr();
cout<<"Program For Fibonacci Series"<<endl;
cout<<"#include<iostream.h>"<<endl;
cout<<"#include<conio.h>"<<endl;
cout<<"void main()"<<endl;
cout<<"{"<<endl;
cout<<" clrscr();"<<endl;
cout<<" int a,b;"<<endl;
cout<<" a=0;"<<endl;
cout<<" b=1;"<<endl;
cout<<" int d;"<<endl;
cout<<" cout<<\"Enter A Number To stop Loop\"<<endl;"<<endl;
cout<<" cin>>d;"<<endl;
cout<<" cout<<\"Fibonnaci Series is\"<<" "<<a<<endl;"<<endl;
cout<<" cout<<\"Fibonnaci Series is\"<<" "<<b<<endl;"<<endl;
cout<<" for(int i=1;i<=d;i++)"<<endl;
cout<<" { int c;"<<endl;
cout<<" c=a+b;"<<endl;
cout<<" a=b;"<<endl;
cout<<" b=c;"<<endl;
cout<<" cout<<\"Fibonnaci Series is\"<<" "<<c<<endl;"<<endl;
cout<<" }"<<endl;
cout<<"getch();"<<endl;
cout<<"}"<<endl;
char ch;
cout<<"Are You Want to Use This Program if Yes Then Enter 'Y' otherwise 'N' "<<endl;
cout<<"=> ";
cin>>ch;
if(ch=='y'||ch=='Y')
{
clrscr();
int a,b;
a=0;
b=1;
int d;
cout<<"Enter A Number To stop Loop"<<endl;
cout<<"=> ";
cin>>d;
cout<<"Fibonnaci Series is:=> "<<" "<<a<<endl;
cout<<"Fibonnaci Series is:=> "<<" "<<b<<endl;
for(int i=1;i<=d;i++)
{
int c;
c=a+b;
a=b;
b=c;
cout<<"Fibonnaci Series is:=> "<<" "<<c<<endl;
}
}
}
else
{
cout<<"Thank You For Using This Software"<<endl;
}
}
else if(ch=='3')
{
clrscr();
cout<<"
!----------------------------------------------------------------------! "<<endl;
cout<<"
|
>>
Functions
<<
| "<<endl;
cout<<"
| 1. Factorial Of Given Number
| "<<endl;
cout<<"
| 2. Fibonnacci Series
| "<<endl;
cout<<"
| 3. Sum of Even And Odd Number
| "<<endl;
cout<<"
| 4. Prime Number
| "<<endl;
cout<<"
| 5. Area Of Circle,Square etc.
| "<<endl;
cout<<"
| 6. Calculator
| "<<endl;
cout<<"
!-----------------------------------------------------------------------! "<<endl;
cout<<endl;
char ch;
cout<<"Enter Your Choice"<<endl;
cout<<"=> ";
cin>>ch;
if(ch=='1')
{
clrscr();
cout<<" >> >> >> >> Function Of Factorial of A Given Number << << << <<"<<endl;
cout<<"#include<iostream.h>"<<endl;
cout<<"#include<conio.h>"<<endl;
cout<<"void fact(int a)"<<endl;
cout<<"{"<<endl;
cout<<" long fact =1;"<<endl;
cout<<" for(int i=a;i>=1;i--)"<<endl;
cout<<" {"<<endl;
cout<<" fact=fact*i;"<<endl;
cout<<" }"<<endl;
cout<<" cout<<\"Factorial Of A Given Number\"<<fact;"<<endl;
cout<<"}"<<endl;
cout<<"void main()"<<endl;
cout<<"{"<<endl;
cout<<" clrscr();"<<endl;
cout<<" int b;"<<endl;
cout<<" cout<<\"Enter A Number\"<<endl;"<<endl;
21
22
cout<<" cin>>b;"<<endl;
cout<<" fact(b);"<<endl;
cout<<" getch();"<<endl;
cout<<"}"<<endl;
cout<<endl;
char ch;
cout<<"Are You Want to Use This Program if Yes Then Enter 'Y' otherwise 'N' "<<endl;
cout<<"=> ";
cin>>ch;
if(ch=='y'||ch=='Y')
{
clrscr();
int a;
long int fact=1;
cout<<"Enter the Number You Want Factorial "<<endl;
cout<<"=> ";
cin>>a;
for(int i=a;i>1;i--)
{
fact=fact*i;
}
cout<<"Factorial of the given number is:=> "<<" "<<fact;
}
else
{
cout<<"Thank You For Using This Software"<<endl;
}
}
else if(ch=='2')
{
clrscr();
cout<<"
>> >> >> >> Function Of Fibonacci << << << <<"<<endl;
cout<<"#include<iostream.h>"<<endl;
cout<<"#include<conio.h>"<<endl;
cout<<"void fibo(int d)"<<endl;
cout<<"{ int a,b;"<<endl;
cout<<" a=0,b=1;"<<endl;
cout<<" cout<<\"Fibonnaci Series is \"<<" "<<a<<endl;"<<endl;
cout<<" cout<<\"Fibonnaci Series is \"<<" "<<b<<endl;"<<endl;
cout<<" for(int i=1;i<=d;i++)"<<endl;
cout<<" { int c;"<<endl;
cout<<" c=a+b;"<<endl;
cout<<" a=b;"<<endl;
cout<<" b=c;"<<endl;
cout<<" cout<<\"Fibonnaci Series is \"<<" "<<c<<endl; }"<<endl;
cout<<" }"<<endl;
cout<<"void main()"<<endl;
cout<<"{ clrscr();"<<endl;
cout<<" int b;"<<endl;
23
24
cout<<" }"<<endl;
cout<<" }"<<endl;
cout<<" cout<<\"Sum Of Even Number is\"<<sumeven<<endl;"<<endl;
cout<<" cout<<\"Sum Of Odd Number is\"<<sumodd<<endl; }"<<endl;
cout<<" void main()"<<endl;
cout<<" { clrscr();"<<endl;
cout<<" int d;"<<endl;
cout<<" cout<<\"Enter A Number \"<<endl;"<<endl;
cout<<" cin>>d;"<<endl;
cout<<" Evenodd(d);"<<endl;
cout<<" getch();"<<endl;
cout<<"}"<<endl;
char ch;
cout<<"Are You Want to Use This Program if Yes Then Enter 'Y' otherwise 'N' "<<endl;
cout<<"=> ";
cin>>ch;
if(ch=='y'||ch=='Y')
{
clrscr();
int a;
cout<<"Enter A Number"<<endl;
cout<<"=> ";
cin>>a;
int sumeven=0,sumodd=0;
for(int i=0;i<=a;i++)
{
if(i%2==0)
{
sumeven=sumeven+i;
}
else
{
sumodd=sumodd+i;
}
}
cout<<"Sum Of Even Number is"<<endl;
cout<<"=> ";
cout<<sumeven<<endl;
cout<<"Sum Of Odd Number is"<<endl;
cout<<"=> ";
cout<<sumodd<<endl;
}
else
{
cout<<"Thank You For Using This Software"<<endl;
}
}
else if(ch=='4')
{
clrscr();
cout<<"
>> >> >> >> Function Of Prime Number << << << <<"<<endl;
cout<<"#include<iostream.h>"<<endl;
cout<<"#include<conio.h>"<<endl;
cout<<"void Prime(int n)"<<endl;
cout<<"{ int a;"<<endl;
cout<<" for(a=2;a<=n;a++)"<<endl;
cout<<" { int flag=0;"<<endl;
cout<<" for(int i=2;i<a;i++)"<<endl;
cout<<" { if(a%i==0)"<<endl;
cout<<" { flag=1;"<<endl;
cout<<"
break; }"<<endl;
cout<<" } if(flag==0)"<<endl;
cout<<" { cout<<\"Prime Number \"<<a<<endl;"<<endl;
cout<<" }"<<endl;
cout<<" }"<<endl;
cout<<"} void main()"<<endl;
cout<<"{ clrscr();"<<endl;
cout<<" int n;"<<endl;
cout<<" cout<<\"Enter A Number To Stop Loop\"<<endl;"<<endl;
cout<<" cin>>n;"<<endl;
cout<<" Prime(n);"<<endl;
cout<<" getch();"<<endl;
cout<<" }"<<endl;
char ch;
cout<<"Are You Want to Use This Program if Yes Then Enter 'Y' otherwise 'N' "<<endl;
cout<<"=> ";
cin>>ch;
if(ch=='y'||ch=='Y')
{
clrscr();
int a,n;
cout<<"Enter A Number To Stop Loop"<<endl;
cout<<"=> ";
cin>>n;
for(a=2;a<=n;a++)
{
int flag=0;
for(int i=2;i<a;i++)
{
if(a%i==0)
{
flag=1;
break;
}
}
if(flag==0)
{
cout<<"Prime Number "<<a<<endl;
25
26
}
}
}
else
{
cout<<"Thank You For Using This Software"<<endl;
}
}
else if(ch=='5')
{
clrscr();
cout<<"Function Of Area"<<endl;
cout<<"#include<iostream.h>"<<endl;
cout<<"#include<conio.h>"<<endl;
cout<<"void Area(int r,char ch)"<<endl;
cout<<"{ switch(ch)"<<endl;
cout<<" { case '1':float area =3.14*r*r;"<<endl;
cout<<"
cout<<\"Area Of Circle is \"<<area;"<<endl;
cout<<"
break;"<<endl;
cout<<" case '2':float area1 =r*r;"<<endl;
cout<<"
cout<<\"Area Of Square is \"<<area1;"<<endl;
cout<<"
break; }"<<endl;
cout<<" } void main() "<<endl;
cout<<" { clrscr();"<<endl;
cout<<" int b;"<<endl;
cout<<" cout<<\"Enter A Number \"<<endl;"<<endl;
cout<<" cin>>b;"<<endl;
cout<<" char ch;"<<endl;
cout<<" cout<<\"Enter Your Choice \"<<endl;"<<endl;
cout<<" cin>>ch;"<<endl;
cout<<" Area(b,ch);"<<endl;
cout<<" getch();"<<endl;
cout<<" }"<<endl;
char ch;
cout<<"Are You Want to Use This Program if Yes Then Enter 'Y' otherwise 'N' "<<endl;
cout<<"=> ";
cin>>ch;
if(ch=='y'||ch=='Y')
{
clrscr();
cout<<"
!------------------------------------------------------------------!"<<endl;
cout<<"
|
>> >> Choose Your Choice << <<
|"<<endl;
cout<<"
|
1. Area Of Circle
|"<<endl;
cout<<"
|
2. Area Of Square
|"<<endl;
cout<<"
!-------------------------------------------------------------------!"<<endl;
char ch;
cout<<"Enter Your choice Which is Given to You"<<endl;
cout<<"=> ";
cin>>ch;
switch(ch)
{
case'1':float area;
int r;
cout<<"Enter Radius of A Circle"<<endl;
cout<<"=> ";
cin>>r;
area=3.14*r*r;
cout<<"Area Of Circle is:=> "<<area;
break;
case'2':float area1;
int a;
cout<<"Enter Side of The Square"<<endl;
cout<<"=> ";
cin>>a;
area1=a*a;
cout<<"Area Of Square is:=> "<<area1;
break;
}
}
else
{
cout<<"Thank You For Using This Software"<<endl;
}
}
else if(ch=='6')
{
clrscr();
cout<<"
>> >> >> >> Function Of A Calculator << << << <<"<<endl;
cout<<"#include<iostream.h>
| void main()"<<endl;
cout<<"#include<conio.h>
| { "<<endl;
cout<<"void Calculate(int a,int b,char ch)
| clrscr();"<<endl;
cout<<"{ int c;
| int d,e; "<<endl;
cout<<" switch(ch)
| char ch; "<<endl;
cout<<" { case '+':c=a+b;
| cout<<\"Enter First Digit\"<<endl;"<<endl;
cout<<" cout<<\"Sum is \"<<c;
| cin>>d;"<<endl;
cout<<" break;
| cout<<\"Enter Second Digit\"<<endl;"<<endl;
cout<<" case '-':c=a-b;
| cin>>e;"<<endl;
cout<<" cout<<\"Subtraction is \"<<c;
| cout<<\"Enter Your Character\"<<endl;"<<endl;
cout<<" break;
| cin>>ch;"<<endl;
cout<<" case '*':c=a*b;
| Calculate(d,e,ch);"<<endl;
cout<<" cout<<\"Multiplication is \"<<c;
| getch();"<<endl;
cout<<" break;
| }"<<endl;
cout<<" case '/':c=a/b;
|"<<endl;
cout<<" cout<<\"Division is \"<<c;
|"<<endl;
cout<<" break;
|"<<endl;
cout<<" }
|"<<endl;
cout<<" }
|"<<endl;
cout<<endl;
27
28
char ch;
cout<<"Are You Want to Use This Program if Yes Then Enter 'Y' otherwise 'N' "<<endl;
cout<<"=> ";
cin>>ch;
if(ch=='y'||ch=='Y')
{
clrscr();
char ch;
cout<<"Enter Your Character "<<endl;
cout<<"=> ";
cin>>ch;
int a,b,c;
cout<<"Enter First Digit "<<endl;
cout<<"=> ";
cin>>a;
cout<<"Enter Second Digit"<<endl;
cout<<"=> ";
cin>>b;
switch(ch)
{
case '+':c=a+b;
cout<<"Sum is:=> "<<c;
break;
case '-':c=a-b;
cout<<"Subtraction is:=> "<<c;
break;
case '*':c=a*b;
cout<<"Multiplication is:=> "<<c;
break;
case '/':c=a/b;
cout<<"Division is:=> "<<c;
break;
}
}
else
{
cout<<"Thank You For Using This Software"<<endl;
}
}}
else if(ch=='4')
{
clrscr();
cout<<"
%-------------------------------------------------------------------------%"<<endl;
cout<<"
|
>> >> >> Array << << <<
|"<<endl;
cout<<"
|
|"<<endl;
cout<<"
| 1. Single Dimensional Array
|"<<endl;
cout<<"
| 2. Double Dimensional Array
|"<<endl;
cout<<"
|
|"<<endl;
cout<<"
%-------------------------------------------------------------------------%"<<endl;
char ch;
cout<<"Enter Your Choice Which is Given to You "<<endl;
cout<<"=> ";
cin>>ch;
if(ch=='1')
{
clrscr();
cout<<"
@--------------------------------------------------------------------@"<<endl;
cout<<"
|
>> Single Dimension Array <<
|"<<endl;
cout<<"
| 1. Display An Array
|"<<endl;
cout<<"
| 2. Sum of An Array
|"<<endl;
cout<<"
| 3. Array of Sum Of Even Odd
|"<<endl;
cout<<"
| 4. Maximum And Minimum Element
|"<<endl;
cout<<"
@--------------------------------------------------------------------@"<<endl;
char ch;
cout<<"Enter Your Choice Which is Given To You"<<endl;
cout<<"=> ";
cin>>ch;
if(ch=='1')
{
clrscr();
cout<<"Program To Display An Array"<<endl;
cout<<"#include<iostream.h>"<<endl;
cout<<"#include<conio.h>"<<endl;
cout<<"void main()"<<endl;
cout<<"{"<<endl;
cout<<" clrscr();"<<endl;
cout<<" int a[10];"<<endl;
cout<<" int n;"<<endl;
cout<<" cout<<\"Enter Your Number To Stop Looping \"<<endl;"<<endl;
cout<<" cin>>n"<<endl;
cout<<" for(int i=0;i<n;i++)"<<endl;
cout<<" {"<<endl;
cout<<" cout<<\"Enter a number\"<<endl;"<<endl;
cout<<" cin>>a[i];"<<endl;
cout<<" }"<<endl;
cout<<" cout<<\"Array is: \"<<endl;"<<endl;
cout<<" for(i=0;i<n;i++)"<<endl;
cout<<" {"<<endl;
cout<<" cout<<a[i]<<endl;"<<endl;
cout<<" }"<<endl;
cout<<" getch();"<<endl;
cout<<"}"<<endl;
char ch;
cout<<"Are You Want to Use This Program if Yes Then Enter 'Y' otherwise 'N' "<<endl;
cout<<"=> ";
cin>>ch;
if(ch=='y'||ch=='Y')
{
29
30
clrscr();
int a[10];
int n;
cout<<"Enter A Number To Stop Looping"<<endl;
cout<<"=> ";
cin>>n;
for(int i=0;i<n;i++)
{
cout<<"Enter a Number:=> ";
cin>>a[i];
}
cout<<"Array is: "<<endl;
for(i=0;i<2;i++)
{
cout<<"=> "<<a[i]<<endl;
}
}
}
else if(ch=='2')
{
clrscr();
cout<<"Program For Sum of An Array"<<endl;
cout<<"#include<iostream.h>"<<endl;
cout<<"#include<conio.h>"<<endl;
cout<<"void main()"<<endl;
cout<<"{"<<endl;
cout<<" clrscr();"<<endl;
cout<<" int a[10];"<<endl;
cout<<" int sum=0;"<<endl;
cout<<" for(int i=0;i<5;i++)"<<endl;
cout<<" {"<<endl;
cout<<" cout<<\"Enter a number\"<<endl;"<<endl;
cout<<" cin>>a[i];"<<endl;
cout<<" }"<<endl;
cout<<" cout<<\"Array is: \"<<endl;"<<endl;
cout<<" for(i=0;i<5;i++)"<<endl;
cout<<" {"<<endl;
cout<<" cout<<a[i]<<endl;"<<endl;
cout<<" sum=sum+a[i];"<<endl;
cout<<" }"<<endl;
cout<<" cout<<\"Sum of the array is: \"<<sum<<endl;"<<endl;
cout<<" getch();"<<endl;
cout<<"}"<<endl;
char ch;
cout<<"Are You Want to Use This Program if Yes Then Enter 'Y' otherwise 'N' "<<endl;
cout<<"=> ";
cin>>ch;
if(ch=='y'||ch=='Y')
{
clrscr();
int a[10];
int sum=0;
for(int i=0;i<5;i++)
{
cout<<"Enter a number:=> ";
cin>>a[i];
}
cout<<"Array is:=> "<<endl;
for(i=0;i<5;i++)
{
cout<<"=> ";
cout<<a[i]<<endl;
sum=sum+a[i];
}
cout<<"Sum of the array is:=> "<<sum<<endl;
}
}
else if(ch=='3')
{
clrscr();
cout<<"Program For Sum of Even and Odd Element of An Array"<<endl;
cout<<"#include<iostream.h>"<<endl;
cout<<"#include<conio.h>"<<endl;
cout<<"void main()"<<endl;
cout<<"{ clrscr();"<<endl;
cout<<" int a[10];"<<endl;
cout<<" int sumeven=0,sumodd=0;"<<endl;
cout<<" for(int i=0;i<5;i++)"<<endl;
cout<<" { cout<<\"Enter a number\"<<endl;"<<endl;
cout<<" cin>>a[i];"<<endl;
cout<<" if(a[i]%2==0)"<<endl;
cout<<" { sumeven=sumeven+a[i];"<<endl;
cout<<" }"<<endl;
cout<<" else"<<endl;
cout<<" { sumodd=sumodd+a[i];"<<endl;
cout<<" }"<<endl;
cout<<" }"<<endl;
cout<<" cout<<\"Sum of the even elements of the array is: \"<<sumeven<<endl;"<<endl;
cout<<" cout<<\"Sum of the odd elements of the array is: \"<<sumodd<<endl;"<<endl;
cout<<" getch();"<<endl;
cout<<" }"<<endl;
char ch;
cout<<"Are You Want to Use This Program if Yes Then Enter 'Y' otherwise 'N' "<<endl;
cout<<"=> ";
cin>>ch;
if(ch=='y'||ch=='Y')
{
clrscr();
31
32
int a[10];
int sumeven=0,sumodd=0;
for(int i=0;i<5;i++)
{
cout<<"Enter a number:=> ";
cin>>a[i];
if(a[i]%2==0)
{
sumeven=sumeven+a[i];
}
else
{
sumodd=sumodd+a[i];
}
}
cout<<"Array is:=> "<<endl;;
for(i=0;i<5;i++)
{
cout<<"=> ";
cout<<a[i]<<endl;
}
cout<<"Sum of the even elements of the array is:=> "<<sumeven<<endl;
cout<<"Sum of the odd elements of the array is:=> "<<sumodd<<endl;
}
}
else if(ch=='4')
{
clrscr();
cout<<"#include<iostream.h>"<<endl;
cout<<"#include<conio.h>"<<endl;
cout<<"void main()"<<endl;
cout<<"{ clrscr();"<<endl;
cout<<" int a[3];"<<endl;
cout<<" for(int i=0;i<3;i++)"<<endl;
cout<<" { cout<<\"Enter a value for the array:=> \"<<endl;"<<endl;
cout<<" cin>>a[i];"<<endl;
cout<<" }"<<endl;
cout<<" }"<<endl;
cout<<" int max=a[0],min=a[0];"<<endl;
cout<<" for(i=0;i<3;i++)"<<endl;
cout<<" { if(a[i]>max)"<<endl;
cout<<" { max=a[i];"<<endl;
cout<<" }"<<endl;
cout<<" if(a[i]<min)"<<endl;
cout<<" { min=a[i];"<<endl;
cout<<" }"<<endl;
cout<<" }"<<endl;
cout<<"} cout<<\"Max element of the array is: \"<<max;"<<endl;
cout<<" cout<<\"Min element of the array is: \"<<min;"<<endl;
cout<<" getch();"<<endl;
cout<<"}"<<endl;
char ch;
cout<<"Are You Want to Use This Program if Yes Then Enter 'Y' otherwise 'N' "<<endl;
cout<<"=> ";
cin>>ch;
if(ch=='y'||ch=='Y')
{
clrscr();
int a[3];
int n;
cout<<"Enter A Number"<<endl;
cout<<"=> ";
cin>>n;
for(int i=0;i<n;i++)
{
cout<<"Enter a value for the array:=> ";
cin>>a[i];
}
int max=a[0],min=a[0];
for(i=0;i<n;i++)
{
if(a[i]>max)
{
max=a[i];
}
if(a[i]<min)
{
min=a[i];
}
}
cout<<"\nMax element of the array is:=> "<<max;
cout<<"\nMin element of the array is:=> "<<min;
}
}
}
else if(ch=='2')
{
clrscr();
cout<<"
@-------------------------------------------------------------------@"<<endl;
cout<<"
|
>> Double Dimension Array <<
|"<<endl;
cout<<"
| 1. Display An Array
|"<<endl;
cout<<"
| 2. Sum of An Array
|"<<endl;
cout<<"
| 3. Array of Sum Of Even Odd
|"<<endl;
cout<<"
| 4. Maximum And Minimum Element
|"<<endl;
cout<<"
@-------------------------------------------------------------------@"<<endl;
char ch;
cout<<"Enter Your Choice Which is Given To You"<<endl;
cout<<"=> ";
33
34
cin>>ch;
if(ch=='3')
{
clrscr();
cout<<"Sum Of Even and Odd Elements of Double Dimensional Array"<<endl;
cout<<"#include<iostream.h>"<<endl;
cout<<"#include<conio.h>"<<endl;
cout<<"void main()"<<endl;
cout<<"{ clrscr();"<<endl;
cout<<" int a[3][3];"<<endl;
cout<<" for(int i=0;i<3;i++)"<<endl;
cout<<" { for(int j=0;j<3;j++)"<<endl;
cout<<" { cout<<\"Enter a value for the array: \"<<endl;"<<endl;
cout<<" cin>>a[i][j]; }"<<endl;
cout<<" }"<<endl;
cout<<" int sumeven=0,sumodd=0;"<<endl;
cout<<" for(i=0;i<3;i++)"<<endl;
cout<<" { for(int j=0;j<3;j++)"<<endl;
cout<<" { if(a[i][j]%2==0)"<<endl;
cout<<" { sumeven=sumeven+a[i][j]; }"<<endl;
cout<<" else"<<endl;
cout<<" { sumodd=sumodd+a[i][j]; }"<<endl;
cout<<" }"<<endl;
cout<<" } cout<<\"Sum of even elements of the array is:=> \"<<sumeven;"<<endl;
cout<<" cout<<\"Sum of odd elements of the array is:=> \"<<sumodd;"<<endl;
cout<<" getch(); }"<<endl;
char ch;
cout<<"Are You Want to Use This Program if Yes Then Enter 'Y' otherwise 'N' "<<endl;
cout<<"=> ";
cin>>ch;
if(ch=='y'||ch=='Y')
{
clrscr();
int a[3][3];
for(int i=0;i<3;i++)
{
for(int j=0;j<3;j++)
{
cout<<"Enter a value for the array: ";
cin>>a[i][j];
}
}
int sumeven=0,sumodd=0;
for(i=0;i<3;i++)
{
for(int j=0;j<3;j++)
{
if(a[i][j]%2==0)
{
sumeven=sumeven+a[i][j];
}
else
{
sumodd=sumodd+a[i][j];
}
}
}
cout<<"\nSum of even elements of the array is: "<<sumeven;
cout<<"\nSum of odd elements of the array is: "<<sumodd;
}
}
}
}
getch();
}
35