SlideShare a Scribd company logo
1 of 28
C++ PRACTICAL FILE


Q1. (a) Program to display the following using single cout
MATHS=90
PHYSICS=77
CHEMISTRY=69
Solution code
//Program to display the program using single cout
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
cout<<"Maths=90nPhysics=77nChemistry=69";
getch();
}
Output




PREPARED BY
BIJENDER KUMAR                                     Page
C++ PRACTICAL FILE


Q1. (b) Program to display the following using multiple
cout
MATHS=90
PHYSICS=77
CHEMISTRY=69
Solution code
//Program to display the program using single cout
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
cout<<"Maths=90";
cout<<"nPhysics=77";
cout<<"nChemistry=69";
getch();
}
Output




PREPARED BY
BIJENDER KUMAR                                    Page
C++ PRACTICAL FILE




Q13. Program to find that entered year is leap year or not
Solution Code
//Program to find entered year is leap or not
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int year;
cout<<"Enter the yearn";
cin>>year;
if(year%4==0)
{
cout<<"Entered year is a leap yearn";
}
else
{
cout<<"Entered year is not a leap year";
}
getch();
}
Output


PREPARED BY
BIJENDER KUMAR                                      Page
C++ PRACTICAL FILE




Q14. Program to solve quadratic equation ax2+bx+c=0
Solution Code
//Program to solve quadratic equation
#include<iostream.h>
#include<conio.h>
#include<math.h>
void main()
{
clrscr();
float a,b,c,d,r1,r2;
cout<<"Enter the value of a,b,cn";
cin>>a>>b>>c;
if(a==0)
{
cout<<"cannot be solve";
}
else
{
d=(b*b)-(4*a*c);
if(d>0)
{
r1=(-b+sqrt(d))/(2*a);

PREPARED BY
BIJENDER KUMAR                                  Page
C++ PRACTICAL FILE


r2=(-b-sqrt(d))/(2*a);
cout<<"Roots are equal and
differentnroot1="<<r1<<"nroot2="<<r2;
}
else if(d==0)
{
r1=r2=-b/(2*a);
cout<<"Roots are real but samenroot1=root2="<<r1;
}
else
{
cout<<"Roots are imaginary";
}
}
getch();
}
Output




PREPARED BY
BIJENDER KUMAR                                  Page
C++ PRACTICAL FILE




Q15. Program to find whether given number is even or
odd
Solution Code
//Program to check number is even or odd
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
intnum,res;
cout<<"Enter the numbern";
cin>>num;
res=num%2;
switch(res)
{
case 0:cout<<"Number is even";
break;
case 1:cout<<"Number is odd";
break;
default:cout<<"Invalid entry";

PREPARED BY
BIJENDER KUMAR                                   Page
C++ PRACTICAL FILE


}
getch();
}




Output




PREPARED BY
BIJENDER KUMAR                        Page
C++ PRACTICAL FILE




Q17. Program to display arithmetic operations using
switch case
Solution Code
//Program for arithmetic operators using switch
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
inta,b,res;
charch;
cout<<"Enter the two numbersn";
cin>>a>>b;
cout<<"Enter the operation to perform +,-,*,/,%n";
cin>>ch;
switch(ch)
{
case '+':res=a+b;
cout<<res;
break;

PREPARED BY
BIJENDER KUMAR                                    Page
C++ PRACTICAL FILE


case '-':res=a-b;
cout<<res;
break;
case '*':res=a*b;
cout<<res;
break;
case '/':res=a/b;
cout<<res;
break;
case '%':res=a%b;
cout<<res;
break;
default:cout<<"Wrong choice";
}
getch();
}
Output




PREPARED BY
BIJENDER KUMAR                            Page
C++ PRACTICAL FILE




Q18. To display first 10 natural no and their sum
Solution code
//Program to display first 10 natural numbers and their
sum
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int sum=0;
cout<<"First 10 natural number aren";
for(int i=1;i<=10;++i)
{
cout<<i<<"n";
sum=sum+i;
}
cout<<"Sum is"<<sum;
getch();
}

PREPARED BY
BIJENDER KUMAR                                      Page
C++ PRACTICAL FILE


Output




Q19. Program to display the fibonacci series
Solution code
//Program to display the fibonacci series
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int a=0,b=1,sum=0,limit;
cout<<"Enter the limit";
cin>>limit;
cout<<a<<"n"<<b<<"n";
for(int i=0;i<=limit-2;++i)
{
sum=a+b;
cout<<sum<<"n";
a=b;
b=sum;
PREPARED BY
BIJENDER KUMAR                                 Page
C++ PRACTICAL FILE


}
getch();
}




Output




PREPARED BY
BIJENDER KUMAR                        Page
C++ PRACTICAL FILE




Q20. Program to find the factorial of a number
Solution code
//Program to display the factorial of a number
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
inta,fact=1;
cout<<"Enter the value of a";
cin>>a;
for(int i=1;i<=a;++i)
{
fact=fact*i;
}
cout<<"The factorial of numberis"<<fact;
getch();

PREPARED BY
BIJENDER KUMAR                                   Page
C++ PRACTICAL FILE


}
Output




Q21. Program to find whether given number is prime or
not
Solution Code
//Program to check number is prime or not
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
intnum,temp=0;
cout<<"Enter the numbern";
cin>>num;
for(int i=2;i<=num-1;++i)
{
if(num%i==0)
{
temp=1;
PREPARED BY
BIJENDER KUMAR                                   Page
C++ PRACTICAL FILE


break;
}
}
if(temp==0)
{
cout<<"Prime Number";
}
else
{
cout<<"Not a prime number";
}
getch();
}
Output




PREPARED BY
BIJENDER KUMAR                            Page
C++ PRACTICAL FILE




Q21. (a) Program to find the sum of the series 1+2+3….n
Solution Code
//Program to find the sum of 1+2+3+..+n
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
intlimit,sum=0;
cout<<"Enter the limitn";
cin>>limit;
for(int i=1;i<=limit;++i)
{
sum=sum+i;
}
cout<<"Answer is"<<sum;

PREPARED BY
BIJENDER KUMAR                                   Page
C++ PRACTICAL FILE


getch();
}
Output




Q21. (b) Program to find the sum of the series
1+1/1!+2/2!+3/3!....n/n!.
Solution Code
//Program to solve the series 1+1/1!+2/2!+3/3!+..+n/n!
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
floatlimit,fact=1,sum=1;
cout<<"Enter the limitn";
cin>>limit;
for(int i=1;i<=limit;++i)
{
for(int j=1;j<=limit;++j)
{

PREPARED BY
BIJENDER KUMAR                                     Page
C++ PRACTICAL FILE


fact=fact*i;
}
sum=sum+i/fact;
fact=1;
}
cout<<"Sum of the series is"<<sum;
getch();
}


Output




PREPARED BY
BIJENDER KUMAR                             Page
C++ PRACTICAL FILE




Q22. (a) Program to generate the following pattern
*
**
***…

Solution Code
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
intch;
cout<<"Enter the number of rowsn";
cin>>ch;
for(int i=1;i<=ch;++i)
{
PREPARED BY
BIJENDER KUMAR                                       Page
C++ PRACTICAL FILE


for(int j=1;j<=i;++j)
{
cout<<"*";
}
cout<<"n";
}
getch();
}


Output




PREPARED BY
BIJENDER KUMAR                               Page
C++ PRACTICAL FILE




Q24. (b) Program to generate the following pattern
1
12
123….

Solution Code
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
intch;
cout<<"Enter the number of rowsn";
cin>>ch;
for(int i=1;i<=ch;++i)

PREPARED BY
BIJENDER KUMAR                                       Page
C++ PRACTICAL FILE


{
for(int j=1;j<=i;++j)
{
cout<<j;
}
cout<<"n";
}
getch();
}


Output




PREPARED BY
BIJENDER KUMAR                               Page
C++ PRACTICAL FILE




Q25. Program to show sum of 10 elements of array and
show the average
Solution Code
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
float a[10],sum=0,avg;
cout<<"Enter 10 elements of arrayn";
for(int i=0;i<10;++i)
{
cin>>a[i];
sum=sum+a[i];
}

PREPARED BY
BIJENDER KUMAR                                  Page
C++ PRACTICAL FILE


avg=sum/10;
cout<<"Sum is"<<sum;
cout<<"nAverage is"<<avg;
getch();
}




Output




PREPARED BY
BIJENDER KUMAR                            Page
C++ PRACTICAL FILE




Q26.Program to perform linear search
Solution code
//Program to perform linear search
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
float a[10],limit,n,f=0,pos;
cout<<"Enter the limit";
cin>>limit;
for(int i=0;i<limit;++i)
{
cin>>a[i];
}

PREPARED BY
BIJENDER KUMAR                             Page
C++ PRACTICAL FILE


cout<<"Enter number you want to search";
cin>>n;
for(i=0;i<limit;++i)
{
if(n==a[i])
{
pos=i+1;
f=1;
}
break;
}
if(f==1)
{
cout<<"The number is at pos"<<pos;
}
else
{
cout<<"Number is not found";
}
getch();
}
Output



PREPARED BY
BIJENDER KUMAR                             Page
C++ PRACTICAL FILE




Q28. Program to find the maximum number in an array
Solution code
//Program to find the maximum number in an array
#include<iostream.h>
#include<conio.h>
void main()
{
int a[10],limit,largest;
cout<<"Enter the limit";
cin>>limit;
cout<<"Enter elements";
for(int i=0;i<limit;++i)
PREPARED BY
BIJENDER KUMAR                                 Page
C++ PRACTICAL FILE


{
cin>>a[i];
}
largest=a[0];
for(i=1;i<limit;++i)
{
if(largest<a[i])
{
largest=a[i];
}
cout<<"Largest number in an array is"<<largest;
}
getch();
}
Output




PREPARED BY
BIJENDER KUMAR                                    Page

More Related Content

What's hot

project report in C++ programming and SQL
project report in C++ programming and SQLproject report in C++ programming and SQL
project report in C++ programming and SQLvikram mahendra
 
54602399 c-examples-51-to-108-programe-ee01083101
54602399 c-examples-51-to-108-programe-ee0108310154602399 c-examples-51-to-108-programe-ee01083101
54602399 c-examples-51-to-108-programe-ee01083101premrings
 
c++ program for Railway reservation
c++ program for Railway reservationc++ program for Railway reservation
c++ program for Railway reservationSwarup Kumar Boro
 
High performance web programming with C++14
High performance web programming with C++14High performance web programming with C++14
High performance web programming with C++14Matthieu Garrigues
 
Pads lab manual final
Pads lab manual finalPads lab manual final
Pads lab manual finalAhalyaR
 
COMPUTER SCIENCE CLASS 12 PRACTICAL FILE
COMPUTER SCIENCE CLASS 12 PRACTICAL FILECOMPUTER SCIENCE CLASS 12 PRACTICAL FILE
COMPUTER SCIENCE CLASS 12 PRACTICAL FILEAnushka Rai
 
C++ project on police station software
C++ project on police station softwareC++ project on police station software
C++ project on police station softwaredharmenderlodhi021
 
81818088 isc-class-xii-computer-science-project-java-programs
81818088 isc-class-xii-computer-science-project-java-programs81818088 isc-class-xii-computer-science-project-java-programs
81818088 isc-class-xii-computer-science-project-java-programsAbhishek Jena
 
Cs pritical file
Cs pritical fileCs pritical file
Cs pritical fileMitul Patel
 
c++ project on restaurant billing
c++ project on restaurant billing c++ project on restaurant billing
c++ project on restaurant billing Swakriti Rathore
 
C++ project
C++ projectC++ project
C++ projectSonu S S
 
Basic Programs of C++
Basic Programs of C++Basic Programs of C++
Basic Programs of C++Bharat Kalia
 
Declaring friend function with inline code
Declaring friend function with inline codeDeclaring friend function with inline code
Declaring friend function with inline codeRajeev Sharan
 
Assignment Examples Final 07 Oct
Assignment Examples Final 07 OctAssignment Examples Final 07 Oct
Assignment Examples Final 07 OctSriram Raj
 
Computer Science investigatory project class 12
Computer Science investigatory project class 12Computer Science investigatory project class 12
Computer Science investigatory project class 12Raunak Yadav
 
Rajeev oops 2nd march
Rajeev oops 2nd marchRajeev oops 2nd march
Rajeev oops 2nd marchRajeev Sharan
 
c-programming-using-pointers
c-programming-using-pointersc-programming-using-pointers
c-programming-using-pointersSushil Mishra
 

What's hot (19)

project report in C++ programming and SQL
project report in C++ programming and SQLproject report in C++ programming and SQL
project report in C++ programming and SQL
 
C++ file
C++ fileC++ file
C++ file
 
54602399 c-examples-51-to-108-programe-ee01083101
54602399 c-examples-51-to-108-programe-ee0108310154602399 c-examples-51-to-108-programe-ee01083101
54602399 c-examples-51-to-108-programe-ee01083101
 
c++ program for Railway reservation
c++ program for Railway reservationc++ program for Railway reservation
c++ program for Railway reservation
 
High performance web programming with C++14
High performance web programming with C++14High performance web programming with C++14
High performance web programming with C++14
 
Pads lab manual final
Pads lab manual finalPads lab manual final
Pads lab manual final
 
COMPUTER SCIENCE CLASS 12 PRACTICAL FILE
COMPUTER SCIENCE CLASS 12 PRACTICAL FILECOMPUTER SCIENCE CLASS 12 PRACTICAL FILE
COMPUTER SCIENCE CLASS 12 PRACTICAL FILE
 
C++ project on police station software
C++ project on police station softwareC++ project on police station software
C++ project on police station software
 
81818088 isc-class-xii-computer-science-project-java-programs
81818088 isc-class-xii-computer-science-project-java-programs81818088 isc-class-xii-computer-science-project-java-programs
81818088 isc-class-xii-computer-science-project-java-programs
 
Cs pritical file
Cs pritical fileCs pritical file
Cs pritical file
 
c++ project on restaurant billing
c++ project on restaurant billing c++ project on restaurant billing
c++ project on restaurant billing
 
C++ project
C++ projectC++ project
C++ project
 
Basic Programs of C++
Basic Programs of C++Basic Programs of C++
Basic Programs of C++
 
Declaring friend function with inline code
Declaring friend function with inline codeDeclaring friend function with inline code
Declaring friend function with inline code
 
Assignment Examples Final 07 Oct
Assignment Examples Final 07 OctAssignment Examples Final 07 Oct
Assignment Examples Final 07 Oct
 
C++ manual Report Full
C++ manual Report FullC++ manual Report Full
C++ manual Report Full
 
Computer Science investigatory project class 12
Computer Science investigatory project class 12Computer Science investigatory project class 12
Computer Science investigatory project class 12
 
Rajeev oops 2nd march
Rajeev oops 2nd marchRajeev oops 2nd march
Rajeev oops 2nd march
 
c-programming-using-pointers
c-programming-using-pointersc-programming-using-pointers
c-programming-using-pointers
 

Similar to Bijender (1)

1 borland c++ 5.02 by aramse
1   borland c++ 5.02 by aramse1   borland c++ 5.02 by aramse
1 borland c++ 5.02 by aramseAram SE
 
Assignement of programming & problem solving ass.(3)
Assignement of programming & problem solving ass.(3)Assignement of programming & problem solving ass.(3)
Assignement of programming & problem solving ass.(3)Syed Umair
 
Lab Manual IV (1).pdf on C++ Programming practice
Lab Manual IV (1).pdf on C++ Programming practiceLab Manual IV (1).pdf on C++ Programming practice
Lab Manual IV (1).pdf on C++ Programming practiceranaibrahim453
 
2014 computer science_question_paper
2014 computer science_question_paper2014 computer science_question_paper
2014 computer science_question_papervandna123
 
'C' language notes (a.p)
'C' language notes (a.p)'C' language notes (a.p)
'C' language notes (a.p)Ashishchinu
 
A.P.S.E PRACTICAL FILE, NIT KURUKSHETRA
A.P.S.E PRACTICAL FILE, NIT KURUKSHETRA A.P.S.E PRACTICAL FILE, NIT KURUKSHETRA
A.P.S.E PRACTICAL FILE, NIT KURUKSHETRA AKSHAY SACHAN
 
Programming fundamentals
Programming fundamentalsProgramming fundamentals
Programming fundamentalsZaibi Gondal
 
pointer.ppt hfkogfhkigfvjjgdsyhhgfdfghjb
pointer.ppt hfkogfhkigfvjjgdsyhhgfdfghjbpointer.ppt hfkogfhkigfvjjgdsyhhgfdfghjb
pointer.ppt hfkogfhkigfvjjgdsyhhgfdfghjbTUSHARGAURAV11
 

Similar to Bijender (1) (20)

C++ assignment
C++ assignmentC++ assignment
C++ assignment
 
C++ file
C++ fileC++ file
C++ file
 
Final DAA_prints.pdf
Final DAA_prints.pdfFinal DAA_prints.pdf
Final DAA_prints.pdf
 
7720
77207720
7720
 
1 borland c++ 5.02 by aramse
1   borland c++ 5.02 by aramse1   borland c++ 5.02 by aramse
1 borland c++ 5.02 by aramse
 
C++ file
C++ fileC++ file
C++ file
 
Assignement of programming & problem solving ass.(3)
Assignement of programming & problem solving ass.(3)Assignement of programming & problem solving ass.(3)
Assignement of programming & problem solving ass.(3)
 
C++ TUTORIAL 8
C++ TUTORIAL 8C++ TUTORIAL 8
C++ TUTORIAL 8
 
Lab Manual IV (1).pdf on C++ Programming practice
Lab Manual IV (1).pdf on C++ Programming practiceLab Manual IV (1).pdf on C++ Programming practice
Lab Manual IV (1).pdf on C++ Programming practice
 
2014 computer science_question_paper
2014 computer science_question_paper2014 computer science_question_paper
2014 computer science_question_paper
 
Cpp programs
Cpp programsCpp programs
Cpp programs
 
C Programming
C ProgrammingC Programming
C Programming
 
operators.ppt
operators.pptoperators.ppt
operators.ppt
 
C++ practical
C++ practicalC++ practical
C++ practical
 
'C' language notes (a.p)
'C' language notes (a.p)'C' language notes (a.p)
'C' language notes (a.p)
 
A.P.S.E PRACTICAL FILE, NIT KURUKSHETRA
A.P.S.E PRACTICAL FILE, NIT KURUKSHETRA A.P.S.E PRACTICAL FILE, NIT KURUKSHETRA
A.P.S.E PRACTICAL FILE, NIT KURUKSHETRA
 
C++
C++C++
C++
 
Programming fundamentals
Programming fundamentalsProgramming fundamentals
Programming fundamentals
 
C Programming Example
C Programming ExampleC Programming Example
C Programming Example
 
pointer.ppt hfkogfhkigfvjjgdsyhhgfdfghjb
pointer.ppt hfkogfhkigfvjjgdsyhhgfdfghjbpointer.ppt hfkogfhkigfvjjgdsyhhgfdfghjb
pointer.ppt hfkogfhkigfvjjgdsyhhgfdfghjb
 

Recently uploaded

Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAndikSusilo4
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 

Recently uploaded (20)

Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 

Bijender (1)

  • 1. C++ PRACTICAL FILE Q1. (a) Program to display the following using single cout MATHS=90 PHYSICS=77 CHEMISTRY=69 Solution code //Program to display the program using single cout #include<iostream.h> #include<conio.h> void main() { clrscr(); cout<<"Maths=90nPhysics=77nChemistry=69"; getch(); } Output PREPARED BY BIJENDER KUMAR Page
  • 2. C++ PRACTICAL FILE Q1. (b) Program to display the following using multiple cout MATHS=90 PHYSICS=77 CHEMISTRY=69 Solution code //Program to display the program using single cout #include<iostream.h> #include<conio.h> void main() { clrscr(); cout<<"Maths=90"; cout<<"nPhysics=77"; cout<<"nChemistry=69"; getch(); } Output PREPARED BY BIJENDER KUMAR Page
  • 3. C++ PRACTICAL FILE Q13. Program to find that entered year is leap year or not Solution Code //Program to find entered year is leap or not #include<iostream.h> #include<conio.h> void main() { clrscr(); int year; cout<<"Enter the yearn"; cin>>year; if(year%4==0) { cout<<"Entered year is a leap yearn"; } else { cout<<"Entered year is not a leap year"; } getch(); } Output PREPARED BY BIJENDER KUMAR Page
  • 4. C++ PRACTICAL FILE Q14. Program to solve quadratic equation ax2+bx+c=0 Solution Code //Program to solve quadratic equation #include<iostream.h> #include<conio.h> #include<math.h> void main() { clrscr(); float a,b,c,d,r1,r2; cout<<"Enter the value of a,b,cn"; cin>>a>>b>>c; if(a==0) { cout<<"cannot be solve"; } else { d=(b*b)-(4*a*c); if(d>0) { r1=(-b+sqrt(d))/(2*a); PREPARED BY BIJENDER KUMAR Page
  • 5. C++ PRACTICAL FILE r2=(-b-sqrt(d))/(2*a); cout<<"Roots are equal and differentnroot1="<<r1<<"nroot2="<<r2; } else if(d==0) { r1=r2=-b/(2*a); cout<<"Roots are real but samenroot1=root2="<<r1; } else { cout<<"Roots are imaginary"; } } getch(); } Output PREPARED BY BIJENDER KUMAR Page
  • 6. C++ PRACTICAL FILE Q15. Program to find whether given number is even or odd Solution Code //Program to check number is even or odd #include<iostream.h> #include<conio.h> void main() { clrscr(); intnum,res; cout<<"Enter the numbern"; cin>>num; res=num%2; switch(res) { case 0:cout<<"Number is even"; break; case 1:cout<<"Number is odd"; break; default:cout<<"Invalid entry"; PREPARED BY BIJENDER KUMAR Page
  • 8. C++ PRACTICAL FILE Q17. Program to display arithmetic operations using switch case Solution Code //Program for arithmetic operators using switch #include<iostream.h> #include<conio.h> void main() { clrscr(); inta,b,res; charch; cout<<"Enter the two numbersn"; cin>>a>>b; cout<<"Enter the operation to perform +,-,*,/,%n"; cin>>ch; switch(ch) { case '+':res=a+b; cout<<res; break; PREPARED BY BIJENDER KUMAR Page
  • 9. C++ PRACTICAL FILE case '-':res=a-b; cout<<res; break; case '*':res=a*b; cout<<res; break; case '/':res=a/b; cout<<res; break; case '%':res=a%b; cout<<res; break; default:cout<<"Wrong choice"; } getch(); } Output PREPARED BY BIJENDER KUMAR Page
  • 10. C++ PRACTICAL FILE Q18. To display first 10 natural no and their sum Solution code //Program to display first 10 natural numbers and their sum #include<iostream.h> #include<conio.h> void main() { clrscr(); int sum=0; cout<<"First 10 natural number aren"; for(int i=1;i<=10;++i) { cout<<i<<"n"; sum=sum+i; } cout<<"Sum is"<<sum; getch(); } PREPARED BY BIJENDER KUMAR Page
  • 11. C++ PRACTICAL FILE Output Q19. Program to display the fibonacci series Solution code //Program to display the fibonacci series #include<iostream.h> #include<conio.h> void main() { clrscr(); int a=0,b=1,sum=0,limit; cout<<"Enter the limit"; cin>>limit; cout<<a<<"n"<<b<<"n"; for(int i=0;i<=limit-2;++i) { sum=a+b; cout<<sum<<"n"; a=b; b=sum; PREPARED BY BIJENDER KUMAR Page
  • 13. C++ PRACTICAL FILE Q20. Program to find the factorial of a number Solution code //Program to display the factorial of a number #include<iostream.h> #include<conio.h> void main() { clrscr(); inta,fact=1; cout<<"Enter the value of a"; cin>>a; for(int i=1;i<=a;++i) { fact=fact*i; } cout<<"The factorial of numberis"<<fact; getch(); PREPARED BY BIJENDER KUMAR Page
  • 14. C++ PRACTICAL FILE } Output Q21. Program to find whether given number is prime or not Solution Code //Program to check number is prime or not #include<iostream.h> #include<conio.h> void main() { clrscr(); intnum,temp=0; cout<<"Enter the numbern"; cin>>num; for(int i=2;i<=num-1;++i) { if(num%i==0) { temp=1; PREPARED BY BIJENDER KUMAR Page
  • 15. C++ PRACTICAL FILE break; } } if(temp==0) { cout<<"Prime Number"; } else { cout<<"Not a prime number"; } getch(); } Output PREPARED BY BIJENDER KUMAR Page
  • 16. C++ PRACTICAL FILE Q21. (a) Program to find the sum of the series 1+2+3….n Solution Code //Program to find the sum of 1+2+3+..+n #include<iostream.h> #include<conio.h> void main() { clrscr(); intlimit,sum=0; cout<<"Enter the limitn"; cin>>limit; for(int i=1;i<=limit;++i) { sum=sum+i; } cout<<"Answer is"<<sum; PREPARED BY BIJENDER KUMAR Page
  • 17. C++ PRACTICAL FILE getch(); } Output Q21. (b) Program to find the sum of the series 1+1/1!+2/2!+3/3!....n/n!. Solution Code //Program to solve the series 1+1/1!+2/2!+3/3!+..+n/n! #include<iostream.h> #include<conio.h> void main() { clrscr(); floatlimit,fact=1,sum=1; cout<<"Enter the limitn"; cin>>limit; for(int i=1;i<=limit;++i) { for(int j=1;j<=limit;++j) { PREPARED BY BIJENDER KUMAR Page
  • 18. C++ PRACTICAL FILE fact=fact*i; } sum=sum+i/fact; fact=1; } cout<<"Sum of the series is"<<sum; getch(); } Output PREPARED BY BIJENDER KUMAR Page
  • 19. C++ PRACTICAL FILE Q22. (a) Program to generate the following pattern * ** ***… Solution Code #include<iostream.h> #include<conio.h> void main() { clrscr(); intch; cout<<"Enter the number of rowsn"; cin>>ch; for(int i=1;i<=ch;++i) { PREPARED BY BIJENDER KUMAR Page
  • 20. C++ PRACTICAL FILE for(int j=1;j<=i;++j) { cout<<"*"; } cout<<"n"; } getch(); } Output PREPARED BY BIJENDER KUMAR Page
  • 21. C++ PRACTICAL FILE Q24. (b) Program to generate the following pattern 1 12 123…. Solution Code #include<iostream.h> #include<conio.h> void main() { clrscr(); intch; cout<<"Enter the number of rowsn"; cin>>ch; for(int i=1;i<=ch;++i) PREPARED BY BIJENDER KUMAR Page
  • 22. C++ PRACTICAL FILE { for(int j=1;j<=i;++j) { cout<<j; } cout<<"n"; } getch(); } Output PREPARED BY BIJENDER KUMAR Page
  • 23. C++ PRACTICAL FILE Q25. Program to show sum of 10 elements of array and show the average Solution Code #include<iostream.h> #include<conio.h> void main() { clrscr(); float a[10],sum=0,avg; cout<<"Enter 10 elements of arrayn"; for(int i=0;i<10;++i) { cin>>a[i]; sum=sum+a[i]; } PREPARED BY BIJENDER KUMAR Page
  • 24. C++ PRACTICAL FILE avg=sum/10; cout<<"Sum is"<<sum; cout<<"nAverage is"<<avg; getch(); } Output PREPARED BY BIJENDER KUMAR Page
  • 25. C++ PRACTICAL FILE Q26.Program to perform linear search Solution code //Program to perform linear search #include<iostream.h> #include<conio.h> void main() { clrscr(); float a[10],limit,n,f=0,pos; cout<<"Enter the limit"; cin>>limit; for(int i=0;i<limit;++i) { cin>>a[i]; } PREPARED BY BIJENDER KUMAR Page
  • 26. C++ PRACTICAL FILE cout<<"Enter number you want to search"; cin>>n; for(i=0;i<limit;++i) { if(n==a[i]) { pos=i+1; f=1; } break; } if(f==1) { cout<<"The number is at pos"<<pos; } else { cout<<"Number is not found"; } getch(); } Output PREPARED BY BIJENDER KUMAR Page
  • 27. C++ PRACTICAL FILE Q28. Program to find the maximum number in an array Solution code //Program to find the maximum number in an array #include<iostream.h> #include<conio.h> void main() { int a[10],limit,largest; cout<<"Enter the limit"; cin>>limit; cout<<"Enter elements"; for(int i=0;i<limit;++i) PREPARED BY BIJENDER KUMAR Page
  • 28. C++ PRACTICAL FILE { cin>>a[i]; } largest=a[0]; for(i=1;i<limit;++i) { if(largest<a[i]) { largest=a[i]; } cout<<"Largest number in an array is"<<largest; } getch(); } Output PREPARED BY BIJENDER KUMAR Page