SlideShare a Scribd company logo
Assignmentof Programming&ProblemSolving
1
//Write a Program that displays the following series using recursion.
//2 4 6 8 10
#include<conio.h>
#include<iostream.h>
void f(int n){
cout<<n<<" ";
if(n<10) f(n+=2);
}
int main(){
f(2);
getch();
}
Output
Output
/*Write a program that input the ‘9’ no. from the user store them in
an array and display the sum and product of these values*/
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int arr[9],i,sum=0,pro=2;
for(i=0;i<9;i++)
{
cout<<"entr values = "; OUTPUT
cin>>arr[i];
sum=sum+arr[i];
}
pro=pro*sum;
cout<<"sum is = "<<sum<<"n";
cout<<"product is = "<<pro<<"n";
getch();
}
Assignmentof Programming&ProblemSolving
2
//Write a Program that takes input in an array of any size and
//reverses it.
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int arr[6];
for(int i=0;i<6;i++)
{
cout<<"entr number";
cin>>arr[i];
}
cout<<"in actual order.n";
for(i=0;i<6;i++)
cout<<arr[i]<<"n";
cout<<"in reverse order.n";
for(i=6;i>=0;i--)
cout<<arr[i]<<"n";
getch();
}
OUTPUT

More Related Content

DOCX
Pratik Bakane C++
DOCX
Pratik Bakane C++
DOCX
Pratik Bakane C++
DOCX
basic programs in C++
DOCX
Pratik Bakane C++
DOCX
Pratik Bakane C++
PPTX
งานนำเสนอ อาจารย์ลาวัลย์
DOCX
Assignement of programming & problem solving(3)a.z
Pratik Bakane C++
Pratik Bakane C++
Pratik Bakane C++
basic programs in C++
Pratik Bakane C++
Pratik Bakane C++
งานนำเสนอ อาจารย์ลาวัลย์
Assignement of programming & problem solving(3)a.z

What's hot (20)

PDF
C++ programs
DOCX
Practical no 5
DOCX
Basic Programs of C++
PDF
Introduction to Computer and Programing - Lecture 04
PDF
DOCX
Assignement of programming & problem solving
DOCX
C Language Programs
PDF
C++ Programming - 3rd Study
PPTX
Activities on Operands
DOCX
C++ assignment
DOC
Add digits of number in c
DOCX
Assignment no 5
DOC
C program to add n numbers
PDF
Operator overloading
PDF
Bcsl 033 data and file structures lab s5-3
PDF
Implement a queue using two stacks.
PDF
Implementing stack
TXT
New text document
PPTX
Adding two integers in c
C++ programs
Practical no 5
Basic Programs of C++
Introduction to Computer and Programing - Lecture 04
Assignement of programming & problem solving
C Language Programs
C++ Programming - 3rd Study
Activities on Operands
C++ assignment
Add digits of number in c
Assignment no 5
C program to add n numbers
Operator overloading
Bcsl 033 data and file structures lab s5-3
Implement a queue using two stacks.
Implementing stack
New text document
Adding two integers in c
Ad

Similar to Assignement of programming & problem solving ass.(3) (20)

PDF
Common problems solving using c
DOC
project report in C++ programming and SQL
DOC
Basic c programs updated on 31.8.2020
PDF
Cse115 lecture08repetitionstructures part02
DOCX
Write a program to check a given number is prime or not
DOC
programming in C++ report
ODT
(4) cpp automatic arrays_pointers_c-strings_exercises
PPT
Apclass (2)
DOCX
CST2403 NOTES
DOCX
DOCX
C_Lab Manual_Part A.docx
PDF
Data Structure using C
PPTX
Array programs
PDF
Object Oriented Programming Using C++ Practical File
DOCX
Chapter 8 c solution
PDF
PCA-2 Programming and Solving 2nd Sem.pdf
DOCX
PCA-2 Programming and Solving 2nd Sem.docx
PPT
PDF
Programming Fundamentals presentation slide
DOCX
Common problems solving using c
project report in C++ programming and SQL
Basic c programs updated on 31.8.2020
Cse115 lecture08repetitionstructures part02
Write a program to check a given number is prime or not
programming in C++ report
(4) cpp automatic arrays_pointers_c-strings_exercises
Apclass (2)
CST2403 NOTES
C_Lab Manual_Part A.docx
Data Structure using C
Array programs
Object Oriented Programming Using C++ Practical File
Chapter 8 c solution
PCA-2 Programming and Solving 2nd Sem.pdf
PCA-2 Programming and Solving 2nd Sem.docx
Programming Fundamentals presentation slide
Ad

More from Syed Umair (20)

TXT
Assignement code
DOCX
Tree 4
DOCX
Title page
DOCX
DOCX
DOCX
DOCX
Perception
DOCX
New microsoft office word document
DOCX
New microsoft office word document (2)
DOCX
DOCX
C++ 4
DOCX
DOCX
Assignement of discrete mathematics
DOCX
DOCX
DOCX
DOCX
Assignment c++12
DOCX
Assignement of discrete mathematics
DOCX
Assignement c++
DOCX
Truth table a.r
Assignement code
Tree 4
Title page
Perception
New microsoft office word document
New microsoft office word document (2)
C++ 4
Assignement of discrete mathematics
Assignment c++12
Assignement of discrete mathematics
Assignement c++
Truth table a.r

Recently uploaded (20)

PPTX
UNDER FIVE CLINICS OR WELL BABY CLINICS.pptx
PPTX
The Healthy Child – Unit II | Child Health Nursing I | B.Sc Nursing 5th Semester
PPTX
Introduction to Child Health Nursing – Unit I | Child Health Nursing I | B.Sc...
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PDF
Pre independence Education in Inndia.pdf
PPTX
How to Manage Starshipit in Odoo 18 - Odoo Slides
PPTX
COMPUTERS AS DATA ANALYSIS IN PRECLINICAL DEVELOPMENT.pptx
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PDF
Anesthesia in Laparoscopic Surgery in India
PDF
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
PPTX
Week 4 Term 3 Study Techniques revisited.pptx
PPTX
Renaissance Architecture: A Journey from Faith to Humanism
PDF
Mark Klimek Lecture Notes_240423 revision books _173037.pdf
PPTX
Pharma ospi slides which help in ospi learning
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PDF
Insiders guide to clinical Medicine.pdf
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PPTX
Cell Structure & Organelles in detailed.
PDF
Electrolyte Disturbances and Fluid Management A clinical and physiological ap...
PDF
O7-L3 Supply Chain Operations - ICLT Program
UNDER FIVE CLINICS OR WELL BABY CLINICS.pptx
The Healthy Child – Unit II | Child Health Nursing I | B.Sc Nursing 5th Semester
Introduction to Child Health Nursing – Unit I | Child Health Nursing I | B.Sc...
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
Pre independence Education in Inndia.pdf
How to Manage Starshipit in Odoo 18 - Odoo Slides
COMPUTERS AS DATA ANALYSIS IN PRECLINICAL DEVELOPMENT.pptx
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
Anesthesia in Laparoscopic Surgery in India
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
Week 4 Term 3 Study Techniques revisited.pptx
Renaissance Architecture: A Journey from Faith to Humanism
Mark Klimek Lecture Notes_240423 revision books _173037.pdf
Pharma ospi slides which help in ospi learning
O5-L3 Freight Transport Ops (International) V1.pdf
Insiders guide to clinical Medicine.pdf
STATICS OF THE RIGID BODIES Hibbelers.pdf
Cell Structure & Organelles in detailed.
Electrolyte Disturbances and Fluid Management A clinical and physiological ap...
O7-L3 Supply Chain Operations - ICLT Program

Assignement of programming & problem solving ass.(3)

  • 1. Assignmentof Programming&ProblemSolving 1 //Write a Program that displays the following series using recursion. //2 4 6 8 10 #include<conio.h> #include<iostream.h> void f(int n){ cout<<n<<" "; if(n<10) f(n+=2); } int main(){ f(2); getch(); } Output Output /*Write a program that input the ‘9’ no. from the user store them in an array and display the sum and product of these values*/ #include<iostream.h> #include<conio.h> void main() { clrscr(); int arr[9],i,sum=0,pro=2; for(i=0;i<9;i++) { cout<<"entr values = "; OUTPUT cin>>arr[i]; sum=sum+arr[i]; } pro=pro*sum; cout<<"sum is = "<<sum<<"n"; cout<<"product is = "<<pro<<"n"; getch(); }
  • 2. Assignmentof Programming&ProblemSolving 2 //Write a Program that takes input in an array of any size and //reverses it. #include<iostream.h> #include<conio.h> void main() { clrscr(); int arr[6]; for(int i=0;i<6;i++) { cout<<"entr number"; cin>>arr[i]; } cout<<"in actual order.n"; for(i=0;i<6;i++) cout<<arr[i]<<"n"; cout<<"in reverse order.n"; for(i=6;i>=0;i--) cout<<arr[i]<<"n"; getch(); } OUTPUT