Computer Assignment
Computer Assignment
B Tech: I Year
Enrollment No. :
…200310964384………………………
……………….
Certificate
This is to certify that the experimental work entered in this journal as per
the B Tech I year syllabus prescribed by the RGPV was done by Mr. / Ms.
………Prayag parashar…………..B Tech I Year II
Signature of Faculty
Prof
Prof
BT205 (Basic
DO’S
❖ Without Prior permission do not enter into the Laboratory.
❖ While entering into the LAB students should wear their ID cards.
❖ The Students should come with proper uniform.
❖ Students should sign in the LOGIN REGISTER before entering into the laboratory.
❖ Students should come with observation and record note book to the laboratory.
❖ Students should maintain silence inside the laboratory.
❖ After completing the laboratory exercise, make sure to shutdown the system properly
DONT’S
SYLLABUS
BT205 (Basic
UNIT I Computer: Definition, Classification, Organization i.e. CPU, register, Bus architecture,
Instruction set, Memory & Storage Systems, I/O Devices, and System & Application Software.
Computer Application in e-Business, Bio-Informatics, health Care, Remote Sensing & GIS,
Meteorology and Climatology, Computer Gaming, Multimedia and Animation etc. Operating
System: Definition, Function, Types, Management of File, Process & Memory. Introduction to
MS word, MS PowerPoint, MS Excel
UNIT III Object & Classes, Scope Resolution Operator, Constructors & Destructors, Friend
Functions, Inheritance, Polymorphism, Overloading Functions & Operators, Types of
Inheritance, Virtual functions. Introduction to Data Structures.
UNIT V Data base Management System: Introduction, File oriented approach and Database
approach, Data Models, Architecture of Database System, Data independence, Data dictionary,
DBA, Primary Key, Data definition language and Manipulation Languages. Cloud computing:
definition, cloud infrastructure, cloud segments or service delivery models (IaaS, PaaS and SaaS),
cloud deployment models/ types of cloud (public, private, community and hybrid clouds), Pros
and Cons of cloud computing.
Lab Objectives
BT205 (Basic
The objective of the lab session of this course is to teach students about
205.CEO1 Review of basics of computer software and need of programming.
205.CEO2 To improve logic building abilities.
205.CEO3 Learn flow chart and basics of algorithm.
205.CEO4 Learn programming using concepts of C and C++.
Lab Outcomes
After the successful completion of the laboratory sessions on Data Structure II the student
will able to
Develop basics of programming skills and algorithms; Judge the difference
between Top Down and Bottom up approach of programming. Gain knowledge
BT205.1 about object-oriented programming and basics of data structures concepts. Know
Problem solving through computer programming; get Familiarity of programming
environment.
Implement the object-oriented concepts to solve problems, develop applications
BT205.2 using object-oriented concepts.
HARDWARE REQUIREMENTS:
SOFTWARE REQUIREMENTS
PREREQUISITE:-
Basics of Computer.
BT205 (Basic
Lab Plan
(BT205) Basic Computer Engineering
Simple Program
8. WAP to print Hello World in C.
9. WAP to print Hello World in C++.
10. WAP to find addition of two integer number.
11. WAP to find addition of two float number.
12. WAP to find average of two number (integer & float) 13. WAP to find average of marks
scored in five subjects.
BT205 (Basic
If-Else
19. WAP to find maximum age of two students.
20. WAP to find largest number among three numbers.
21. WAP to find whether number is negative or positive.
22. WAP to check number is even or odd.
23. WAP to check whether year is leap year or not.
24. WAP to check whether enter character is vowel or consonant.
25. WAP to find largest number among two number.
Switch Case
26. WAP to make simple calculation for all arithmetic operations (+, -, *, /, %).
27. WAP to check whether enter character is vowel or consonant.
28. WAP to display day of week as user choice.
Loops Statements
29. WAP to print Hello World five times.
30. WAP to print natural number (1 to 10).
31. WAP to print natural number in reverse order (10 to 1).
32. WAP to find the factorial of a number using while loop.
33. WAP to print Fibonacci series until given terms.
34. WAP to display sum of n natural number where n is entered by user.
35. WAP to display reverse of any number using loop.
36. WAP to sum all the numbers entered by the users until user enter 0.
37. WAP to display reverse of five digits number using loop.
38. WAP to print number within range given by user.
39. WAP to print number table using multiplication operation.
40. WAP to print number table using addition operation.
41. WAP to generate prime numbers series up to n number using for loop.
42. WAP to find the sum of all digit of digit using loop.
43. WAP to print pattern
BT205 (Basic
* 1 A 1 ***** 12345
** 12 AB 23 **** 1234
*** 123 ABC 345 *** 123
**** 1234 ABCD 4567 ** 12
***** 12345 ABCDE 56789 * 1
ABCDE 12345 * 1 A 1
ABCD 2345 ** 12 AB 23
ABC 345 *** 123 ABC 345
AB 45 **** 1234 ABCD 4567
A 5 ***** 12345 ABCDE 56789
Functions
51. WAP for sum of two numbers using function.
52. WAP to swap values of two number using function
BT205 (Basic
Structure
60. WAP to display record of student using Structure.
61. WAP to display record of student using Union.
62. WAP to display record of five students using Structure.
Inheritance
68. WAP to demonstrate the single inheritance
69. WAP to demonstrate the multilevel inheritance
70. WAP to demonstrate the multiple inheritance
71. WAP to demonstrate the hierarchical inheritance
72. WAP to demonstrate the hybrid inheritance.
Friend Function
73. WAP to demonstrate the use of friend function.
Polymorphisms
74. WAP to demonstrate the use of function overloading.
75. WAP to demonstrate the use of function overriding.
BT205 (Basic
Data Structure
79. WAP to demonstrate the array using row major order and column major order.
80. WAP to demonstrate the use of Stack.
81. WAP to demonstrate the use of Queue.
82. WAP to demonstrate the use of Linked List.
BT205 (Basic
Index
S. Date of Date of Grade & Sign
Name of the Experiment Status
No. Exp. Submission of the Faculty
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
24
25
26
27
28
29
30
31
32
33
34
BT205 (Basic
Signature of Student
BT205 (Basic
INDORE
Name of Student: Prayag parashar Class: IT-First Year
Enrollment No: Batch
Date of Experiment: Date of Submission: Submitted on:
Remarks by faculty: Grade:
Signature of student: Signature of Faculty:
Experiment no. 1:
Study & Practice of Internal and External DOS command
INDORE
Name of Student: Prayag Parashar Class: IT-First Year
Enrollment No: Batch
Date of Experiment: Date of Submission: Submitted on:
Remarks by faculty: Grade:
Signature of student: Signature of Faculty:
Experiment no. 2:
Study & Practice of Basic Linux commands.
INDORE
Name of Student: Prayag Parashar Class: IT-First Year
Enrollment No: Batch
Date of Experiment: Date of Submission: Submitted on:
Remarks by faculty: Grade:
Signature of student: Signature of Faculty:
Experiment 3:
Study and Practice of MS windows – Folder related operations, My Computer, window
explorer, Control Panel.
INDORE
Name of Student: Prayag Parashar Class: IT-First Year
Enrollment No: Batch
Date of Experiment: Date of Submission: Submitted on:
Remarks by faculty: Grade:
Signature of student: Signature of Faculty:
Experiment 4:
Creation and editing of text files using MS-Word.
Experiment 5:
Creation and operating of spreadsheet using MS-Excel.
Experiment 6: Creation and editing power-point slides using MS- power point
Experiment 7:
Study & Practice of Flowchart & Algorithm.
Experiment 8:
WAP to print Hello World in C
Output:
Signature of student:
cout<<"Hello world";
return 0;
}
Output:
INDORE
Name of Student: Prayag Parashar Class: IT-
Enrollment No: Batch
Date of Experiment: Date of Submission: Submitted on:
Remarks by faculty: Grade:
Signature of student: Signature of Faculty:
Experiment 10:
Write a Program to find addition of two integer number.
Output:
INDORE
INDORE
Name of Student: Prayag Parashar Class: IT-First Year
Enrollment No: Batch
Date of Experiment: Date of Submission: Submitted on:
Remarks by faculty: Grade:
Signature of student: Signature of Faculty:
Experiment 11:
Write a Program to find addition of integer number and float number.
INDORE
Name of Student: Prayag Parashar Class: IT
Enrollment No: Batch
Date of Experiment: Date of Submission: Submitted on:
Remarks by faculty: Grade:
Signature of student: Signature of Faculty:
Output:
Experiment 12:
Write a Program to find average of two numbers (integer & float)
#include<iostream>
using namespace std;
int main()
{
Int a,b,sum;
INDORE
Name of Student: Prayag Parashar Class: IT-First Year
Enrollment No: Batch
Date of Experiment: Date of Submission: Submitted on:
Remarks by faculty: Grade:
Signature of student: Signature of Faculty:
Floet avg;
Printf(“Enter first number:-“);
Scanf(“%d,”,&a);
Printf(“Enter second number:-“);
Scanf(“%d”,&b);
Sum=a+b;
Avg= (float)(a+b)/2;
Printf(“\n sum of %d and %d is = %d”,a,b,sum);
Printf(“\n average of %d and %d is = %f”,a,b,avg):
Return0;
}
Output:
INDORE
Name of Student: Prayag Parashar Class: IT
Enrollment No: Batch
Date of Experiment: Date of Submission: Submitted on:
Remarks by faculty: Grade:
Signature of student: Signature of Faculty:
Experiment 13:
Write a Program to find average of marks scored in five subjects.
#include<stdio.h>
int man()
{
int computer, maths, English, physics, chemistry;
float total, average;
printf(“ enter the marks of five subjects:-\n);
scanf(%d%d%d%d%d”, &computer, &maths, &English, &physics, &chemistry);
Experiment 14:
Write a Program to exchange value of two variables
i. Using third variable.
1) #include<iostream>
using namespace std;
int main()
{
int num1, num2, temp;
cout <<” Enter first number:-“;
cin>>num1;
cout<<” Enter second number:-“;
cin>>num2;
2)
#include<iostream>
using namespace std;
{
int a=5, b=10;
cout<<”before swap a= “<<a<<” b=<<b<<endl;
a = a*b;
b = a/b;
a = a/b;
cout<<”after swap a=”<<a<<” b=”<<b<<endl;
return 0;
}
Output:
Experiment 15:
Write a Program to convert
i. Temperature C to F
ii. Temperature F to C
1)
#include<stdio.h>
int main()
{
float celsius, fahrenheit;
printf(“Enter temperature in celsius:-“);
scanf(“%f”, &celsius);
fahrenheit = (celsius*9/5)+32;
printf(“%.2f celsius = %.2f fahrenheit”,celsius, fahrenheit);
return 0;
}
Output:
2)
#include<stdio.h>
int main()
{
float fahrenheit, celsius;
printf(“Enter temperature in fahrenheit:-“);
scanf(“%f”, &fahrenheit);
celsius = (fahrenheit*9/5)+32;
printf(“%.2f fahrenheit = %.2f celsius”, fahrenheit, celsius);
return 0;
}
Output:
Signature of Faculty:
Experiment 16:
Write a Program to find the area of circle
Include<iostream>
Using
namespacestd;
int main()
{
int radius ;
float area;
printf(“Enter radius of the circle:-“);
scanf(“%d”, &radius);
area=(22*radius*radius)/7;
printf(“area of circle: %f/n”, area);
return 0;
}
Output:
Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
Experiment 17:
Write a Program to print reverse of number (five-digit number)
#include<iostream>
using namespace std;
int main()
{
int n, rev=0, rem;
cout<<"Enter an integer;-";
cin>>n;
while(n!=0)
{
rem = n%10;
rev = rev*10+rem;
n/=10;
}
cout<<"rev = "<< rev;
return 0;
}
Output:
Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
Experiment 18:
Write a Program to find the sum of all digit of given digit (five-digit number).
#include<stdio.h>
int main()
{
int n, t, sum=0,remainder;
printf("Enter a integer\n");
scanf("%d", &n);
t=n;
while(t!=0)
{
remainder=t%10;
sum=sum+remainder;
t = t/10;
}
printf("sum of digits of %d =%d\n", n, sum);
return 0;
}
Output:
Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
Experiment 19:
Write a Program to find maximum age among two students.
#include<stdio.h>
int main()
{
int student1, student2;
Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
Signature of Faculty:
Output:
Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
Experiment 20:
Write a Program to find largest number among three numbers.
#include<stdio.h>
int main()
{
int num1, num2, num3;
printf("Enter the value of num1, num2, num3\n");
scanf("%d %d %d", &num1, &num2, &num3);
printf("num1 = %d\tnum2 = %d\tnum3 = %d\n", num1, num2, num3);
if(num1>num2)
{
if(num1>num3)
{
printf("num1 is the largest among three \n");
}
else
{
printf("num3 is the largest among three \n");
}
}
else if (num2>num3)
printf("num2 is the largest among three \n");
else
printf("num3 is the largest among three \n");
}
Output:
Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
Signature of Faculty:
Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
Experiment 21:
write a program to check wheather number is positive or negative.
#include<iostream>
using namespace std;
int main()
{
int num;
cout<<”Enter the number to be checked:-“;
cin>>num;
if(num>=0)
cout<<num<<”is a positive number”;
else
cout<<num<<”is a negative number”;
return 0;
}
Output:
Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
Signature of Faculty:
Experiment 22:
write a program to check number is even or odd.
#include<iostream>
using namespace std;
int main()
{
int n;
cout<<"Enter an integer:-";
cin>>n;
if(n%2==0)
cout<<n<<"is even.";
else
cout<<n<<"is odd.";
return 0;
}
Output:
Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
Experiment 23:
write a program whether year is leap year or not.
#include<iostream>
using namespace std;
int main()
{
int year;
cout<<"Enter an year:- ";
cin>>year;
if(year%4==0)
{
if (year%100==0)
{
if(year%400==0)
cout<<year<<" is a leap year";
else
cout<<year<<" is nat a leap year";
}
else
Output:
Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
Signature of Faculty:
Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
Experiment 24:
write a program to check whether enter character is vowel or consonant.
#include<iostream>
using namespace std;
int main()
{
char n;
int isLowercaseVowel, isUppercaseVowel;
cout<<"Enter an alphabet:- ";
cin>>n;
if(isLowercaseVowel || isUppercaseVowel)
cout<<n<<" is a vowel";
else
cout<<n<<" is a consonant";
return 0;
}
Output:
Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
Signature of Faculty:
Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
Experiment 25:
write a program to find largest number among two number.
#include<stdio.h>
int main()
{
int num1, num2;
printf("Enter the value of num1, num2\n");
scanf("%d %d", &num1, &num2);
printf("num1 = %d\tnum2 = %d\n", num1, num2);
if(num1>num2)
{
if(num1>num2)
{
printf("num1 is the largest among two \n");
}
else
{
printf("num2 is the largest among two \n");
}
}
else if (num2>num1)
printf("num2 is the largest among two \n");
return 0;
}
Output:
Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
Signature of Faculty:
Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
Experiment 26:
write a program to make simple calculation for all arithmetic operations (+,-
,*,/,%).
#include<iostream>
using namespace std;
int main()
{
char op;
float num1, num2;
cout<< "Enter operator either + or - or * or /:- ";
cin>> op;
cout<< " Enter two numbers;- ";
cin >> num1 >> num2;
switch(op)
{
case '+':
cout << num1+num2;
break;
case '-':
cout << num1-num2;
break;
case '*':
cout << num1*num2;
break;
case '/':
cout << num1/num2;
break;
default:
Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
Signature of Faculty:
Output:
Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
Experiment 27:
write a program to check whether enter character is vowel or consonant.
#include<iostream>
using namespace std;
int main()
{
char n;
int isLowercaseVowel, isUppercaseVowel;
cout<<"Enter an alphabet:- ";
cin>>n;
if(isLowercaseVowel || isUppercaseVowel)
cout<<n<<" is a vowel";
else
cout<<n<<" is a consonant";
return 0;
}
Output:
Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
Signature of Faculty:
Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
Experiment 28:
write a program to display day of week as user choice.
#include<iostream>
using namespace std;
int main()
{
int weeknumber;
switch(weeknumber)
{
case 1: cout<<"Monday";
break;
case 2: cout<<"Tuesday";
break;
case 3: cout<<"Wednesday";
break;
case 4: cout<<"Thursday";
break;
case 5: cout<<"Friday";
break;
case 6: cout<<"Saturday";
break;
case 7: cout<<"Sunday";
break;
}
return 0;
}
Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
Signature of Faculty:
Output:
Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
Experiment 29:
write a program HELLO WORLD five times.
#include<iostream>
using namespace std;
int main()
{
for(int i=1; i<=5; ++i)
{
cout << "Hello World! "<<endl;
}
return 0;
}
Output:
Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
Signature of Faculty:
Experiment 30:
write a program to print natural number (1 to 10).
#include<iostream>
using namespace std;
int main()
{
int i, sum=0;
cout<<"The first 10 natural number are:- \n";
i=1;
while(i<=10)
{
sum=sum=i;
cout<<" "<<i;
i++;
}
cout<<"\n The sum is:- "<<sum;
}
Output:
Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
Signature of Faculty:
Experiment 31:
write a program to print number in reverse order(10 to 1).
#include<iostream>
using namespace std;
int main()
{
int number;
cout<<"\nEnter value to print natural number = ";
cin>>number;
int i = number;
Output:
Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
Signature of Faculty:
Experiment 32:
write a program to find the factorial of a number using while loop.
#include<iostream>
using namespace std;
int main()
{
cout<<"Enter a number to calculate its factorial"<<endl;
int i,fact;
cin>>i;
fact=i;
while(i>1)
{
i--;
fact=fact*i;
}
cout<<"Factorial value:- "<<fact;
return 0;
}
Output:
Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
Signature of Faculty:
Experiment 33:
write a program to print Fibonacci series until given terms.
#include<iostream>
using namespace std;
int main()
{
int n;
long int f=0;
cout<<"\Enter any value of number";
cin>>n;
int a,b;
a=0;
b=1;
cout<<"\nFibonacci series are:- \n";
cout<<a<<" "<<b;
while(n-2>0)
{
f=a+b;
cout<<" "<<f;
a=b;
b=f;
n--;
}
}
Output:
Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
Signature of Faculty:
Experiment 34:
write a program to display sum of n natural number where n is entered by user.
#include<stdio.h>
int main()
{
int i, n, sum=0;
printf("Input value of terms: ");
scanf("%d", &n);
printf("\nThe first %d natural numbers are:\n",n);
for(i=1; i<=n; i++)
{
printf("%d ",i);
sum+=i;
}
printf("\nThe sum of natural number upto %d terms : %d \n", n, sum);
}
Output:
Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
Experiment 35:
write a program to display reverse of any number using loop.
#include<iostream>
using namespace std;
int main()
{
int n, reversedNumber = 0, remainder;
cout<<"Enter an integer:- ";
cin>>n;
while (n!=0)
{
remainder =n%10;
reversedNumber = reversedNumber*10 + remainder;
n/=10;
}
cout<<"Reversed Number = "<<reversedNumber;
return 0;
}
Output:
Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
Signature of Faculty:
Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
Experiment 36:
write a program to sum all the numbers entered by the users until user enter 0.
#include<iostream>
using namespace std;
int main()
{
int num, sum = 0;
do
{
printf("Enter a number:-");
scanf("%1f", &num);
sum += num;
}
while(num!=0);
printf("Total = %d",sum);
return 0;
}
Output:
Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
Signature of Faculty:
Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
Experiment 37:
write a program to display reverse of five digits number using loop.
#include<iostream>
using namespace std;
int main()
{
int number,reversed_num=0;
cout<<"Enter a number"<<endl;
cin>>number;
cout<<"you entered: "<<number;
while(number!=0)
{
reversed_num=reversed_num*10;
reversed_num=reversed_num+number%10;
number=number/10;
}
cout<<"\nReversed number is: "<<reversed_num;
return 0;
}
Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
Signature of Faculty:
Output:
Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
Experiment 38:
write a program to print number within range given by user.
Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
Signature of Faculty:
Experiment 39:
write a program to print number table using multiplication operation.
#include<iostream>
using namespace std;
int main()
{
int n;
cout<<"Enter a number: ";
cin>>n;
for (int i=1; i<=10; i++)
{
cout << n << " * " << i << " * " << n * i << endl;
}
return 0;
}
Output:
Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
Signature of Faculty:
Experiment 40:
write a program to print number table using addition operation.
#include<iostream>
using namespace std;
int main()
{
int i,no,table=1;
cout<<"Enter any num: ";
cin>>no;
cout<<"Table of "<<no;
for(i=1;i<=10;i++)
{
table=no*i;
cout<<" \n"<<table;
cout<<"\n";
}
return 0;
}
Output:
Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
Signature of Faculty:
Experiment 41:
write a program to generate prime numbers series up to n number using for loop.
#include<stdio.h>
int main()
{
int i, j, n;
printf("Enter the number till which you want prime number\n");
scanf("%d",&n);
Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
}
}
}
Output:
Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
Signature of Faculty:
Experiment 42:
write a program to find the sum of all digit of digit using loop.
#include<iostream>
using namespace std;
int main()
{
int n,sum=0,m;
cout<<"Enter a number: ";
cin>>n;
while(n>0)
{
m=n%10;
sum=sum+m;
n=n/10;
}
cout<<"sum is= "<<sum<<endl;
return 0;
}
Output:
Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
Signature of Faculty:
Experiment 43:
write a program to print pattern
1)
#include<iostream>
using namespace std;
int main()
{
int n;
cin>>n;
for(int i=1;i<=n;i++)
{
for(int j=1;j<=i;j++)
cout<<"*";
cout<<"\n";
}
}
Output:
Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
Signature of Faculty:
2)
#include<iostream>
using namespace std;
int main()
{
int n;
cin>>n;
for(int i=1;i<=n;i++)
{
for(int j=1;j<=i;j++)
cout<<j;
cout<<"\n";
}
}
Output:
Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
3)
#include<iostream>
using namespace std;
int main()
{
int n;
cin>>n;
for(int i=1;i<=n;i++)
{ char ch='A';
for(int j=1;j<=i;j++)
cout<<ch++;
cout<<"\n";
}
}
Output:
Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
Signature of Faculty:
4)
#include<iostream>
using namespace std;
int main()
{
int n;
cin>>n;
for(int i=1;i<=n;i++)
{ int ch=i;
for(int j=1;j<=i;j++)
cout<<ch++;
cout<<"\n";
}
}
Output:
Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
5)
#include<iostream>
using namespace std;
int main()
{
int n;
cin>>n;
for(int i=n;i>=1;i--)
{
for(int j=1;j<=i;j++)
cout<<"*";
cout<<endl;
}
}
Output:
Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
Signature of Faculty:
Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
6)
#include<iostream>
using namespace std;
int main()
{
int n;
cin>>n;
for(int i=n;i>=1;i--)
{
for(int j=1;j<=i;j++)
cout<<j;
cout<<"\n";
}
}
Output:
Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
Signature of Faculty:
7)
#include<iostream>
using namespace std;
int main()
{
int n;
cin>>n;
for(int i=n;i>=1;i--)
{ char ch='A';
for(int j=1;j<=i;j++)
cout<<ch++;
cout<<"\n";
}
}
Output:
Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
8)
#include<iostream>
using namespace std;
int main()
{
int n;
cin>>n;
for(int i=1;i<=5;i++)
{ int ch=i;
for(int j=i;j<=5;j++)
cout<<ch++;
cout<<"\n";
}
}
Output:
Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
Signature of Faculty:
9)
#include<iostream>
using namespace std;
int main()
{
int i, j, r;
cin>>r;
for(int i=1;i<=r;i++)
{
for(int j=i;j<=r;j++)
{
cout<<" ";
}
for(j=1; j<=i; j++)
{
cout<<"*";
}
cout<<"\n";
}
return 0;
}
Output:
Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
Signature of Faculty:
10)
#include<iostream>
using namespace std;
int main()
{
int i, j, r;
cin>>r;
for(int i=1;i<=r;i++)
{ char ch='A';
for(int j=i;j<=r;j++)
{
cout<<" ";
}
for(j=1; j<=i; j++)
{
cout<<j;
}
cout<<"\n";
}
return 0;
}
Output:
Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
Signature of Faculty:
11)
#include<iostream>
using namespace std;
int main()
{
int i, j, r;
cin>>r;
for(int i=1;i<=r;i++)
{ char ch='A';
for(int j=i;j<=r;j++)
{
cout<<" ";
}
for(j=1; j<=i; j++)
{
cout<<ch++;
}
cout<<"\n";
}
return 0;
}
Output:
Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
Signature of Faculty:
12)
#include<iostream>
using namespace std;
int main()
{
int i, j, r;
cin>>r;
for(int i=1;i<=r;i++)
{ int ch=i;
for(int j=i;j<=r;j++)
{
cout<<" ";
}
for(j=1; j<=i; j++)
{
cout<<ch++;
}
cout<<"\n";
}
return 0;
}
Output:
Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
Signature of Faculty:
13)
#include<iostream>
using namespace std;
int main()
{
int i, j, r;
cin>>r;
for(int i=1;i<=r;i++)
{
for(int j=1;j<i;j++)
{
cout<<" ";
}
for(j=i; j<=r; j++)
{
cout<<"&";
}
cout<<"\n";
}
return 0;
}
Output:
Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
Signature of Faculty:
14)
#include<iostream>
using namespace std;
int main()
{
int n;
cin>>n;
for(int i=5;i>=1;i--)
{
for(int k=1;k<=n-i;k++)
cout<<" ";
cout<<j;
cout<<"\n";
}
}
Output:
Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
Signature of Faculty:
15)
#include<iostream>
using namespace std;
int main()
{
int i, j, r;
cin>>r;
for(int i=1;i<=r;i++)
{ char ch='A';
for(int j=1;j<i;j++)
{
cout<<" ";
}
for(j=i; j<=r; j++)
{
cout<<ch++;
}
cout<<"\n";
}
return 0;
}
Output:
Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
Signature of Faculty:
16)
#include<iostream>
using namespace std;
int main()
{
int i, j, r;
cin>>r;
for(int i=1;i<=r;i++)
{ int ch=i;
for(int j=1;j<i;j++)
{
cout<<" ";
}
for(j=i; j<=r; j++)
{
cout<<ch++;
}
cout<<"\n";
}
return 0;
}
Output:
Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
Signature of Faculty:
17)
#include<iostream>
using namespace std;
int main()
{
int n, s, i, j;
cout<<"Enter the number of rows:";
cin>>n;
for(int i=1;i<=n;i++)
{
for(int s=i;s<n;s++)
{
cout<<" ";
}
for(j=1; j<=i; j++)
{
cout<<"& ";
}
cout<<"\n";
}
return 0;
}
Output:
Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
Signature of Faculty:
18)
#include<iostream>
using namespace std;
int main()
{
int n, s, i, j;
cout<<"Enter the number of rows:";
cin>>n;
for(int i=n;i>=1;i--)
{
for(int s=i;s<n;s++)
{
cout<<" ";
}
for(j=1; j<=i; j++)
{
cout<<"& ";
}
cout<<"\n";
}
return 0;
}
Output:
Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
Signature of Faculty:
19)
#include<iostream>
using namespace std;
int main()
{
int i, j, r;
cin>>r;
for(int i=1;i<=r;i++)
{
for(int j=i;j<r;j++)
{
cout<<" ";
}
for(j=1; j<=(2*i-1); j++)
{
cout<<"&";
}
cout<<"\n";
}
return 0;
}
Output:
Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
20)
#include<iostream>
using namespace std;
int main()
{
int i, j, r;
cin>>r;
for(int i=1;i<=r;i++)
{
for(int j=1;j<i;j++)
{
cout<<" ";
}
Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
Signature of Faculty:
Output:
Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
21)
#include<iostream>
using namespace std;
int main()
{
int i, j, n;
cin >> n;
for(i=0; i<=n; i++)
{
for(j=1; j<=n-i; j++)
cout<<" ";
for(j=1; j<=2*i-1; j++)
cout<<"&";
cout<<endl;
}
for(i=n-1; i>=1; i--)
{
for(j=1; j<=n-i; j++)
cout<<" ";
for(j=1; j<=2*i-1; j++)
cout<<"&";
cout<<endl;;
}
}
Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
Signature of Faculty:
Output:
22)
#include<iostream>
using namespace std;
int main()
{
int i, j, k, m, a =1, b=0;
for(i=5; i>0; i--)
{
for(j=i; j>0; j--)
{
cout<<"&";
Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
}
for(k=1; k<a; k++)
{
cout<<" ";
}
a=a+2;
for(m=i; m>0; m--)
{
cout<<"&";
}
cout<<endl;
}
for(i=1; i<=4; i++)
{
for(j=0; j<=i; j++)
{
cout<<"&";
}
for(k=6; k>b; k--)
{
cout<<" ";
}
b=b+2;
Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
Signature of Faculty:
Output:
Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
Output:
Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
Signature of Faculty:
Experiment 45:
Write a program to input number from user and display in an array.
#include<iostream>
using namespace std;
int main()
{
int numbers[5];
cout<<"Enter 5 numbers: "<<endl;
for(int i=0; i<5; ++i)
{
cin>>numbers[i];
}
cout<<"The numbers are: ";
for(int n=0; n<5; ++n)
{
cout<<numbers[n]<<" ";
}
return 0;
}
Output:
Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
Signature of Faculty:
Manual