You are on page 1of 135

PRACTICAL JOURNAL OF

Basic Computer Engineering

B Tech: I Year

Department of Information Technology

Name of the Student : ………Prayag parashar…………………

Branch & section : branch- electronics and


communication (E.C.)

Enrollment No. :
…200310964384………………………
……………….

Session : Jan-Jun 2021

Department of Information Technology


AITR, Indore.
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

Department of Information Technology

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

Semester Branch & Section …..….. in the Basic Computer


Engineering Laboratory of this institute during the academic year
2018- 2019.

Signature of Faculty

Prof

Prof

GENERAL INSTRUCTIONS FOR LABORATORY CLASSES

BT205 (Basic

Computer Engineering) Lab Manual


ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

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

❖ Students bringing the bags inside the laboratory.


❖ Students using the computers in an improper way.
❖ Students scribbling on the desk and mishandling the chairs.
❖ Students using mobile phones inside the laboratory.
❖ Students making noise inside the laboratory.

SYLLABUS
BT205 (Basic

Computer Engineering) Lab Manual


ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

BT-205 (Basic Computer Engineering)

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 II Introduction to Algorithms, Complexities and Flowchart, Introduction to Programming,


Categories of Programming Languages, Program Design, Programming Paradigms,
Characteristics or Concepts of OOP, Procedure Oriented Programming VS objectoriented
Programming. Introduction to C++: Character Set, Tokens, Precedence and Associativity,
Program Structure, Data Types, Variables, Operators, Expressions, Statements and control
structures, I/O operations, Array, Functions,

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 IV Computer Networking: Introduction, Goals, ISO-OSI Model, Functions of Different


Layers. Internetworking Concepts, Devices, TCP/IP Model. Introduction to Internet, World Wide
Web, Ecommerce Computer Security Basics: Introduction to viruses, worms, malware, Trojans,
Spyware and AntiSpyWare Software, Different types of attacks like Money
Laundering, Information Theft, Cyber Pornography, Email spoofing, Denial of Service (DoS),
Cyber Stalking, ,Logic bombs, Hacking Spamming, Cyber Defamation , pharming Security
measures Firewall, Computer Ethics & Good Practices, Introduction of Cyber Laws about
Internet Fraud, Good Computer Security Habits,

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

Computer Engineering) Lab Manual


ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

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:

Processors - 2.0 GHz or Higher


RAM - 256 MB or Higher
Hard Disk - 20 GB or Higher

SOFTWARE REQUIREMENTS

Operating System: WINDOWS XP, Windows 7/8


Compiler: Dev-Cpp 5.11 TDM-GCC 4.9.2

PREREQUISITE:-

Basics of Computer.

Teaching and Examination Scheme

BT205 (Basic

Computer Engineering) Lab Manual


ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

Maximum Marks Allotted Hours/Week Credits


Theory Practical
L T P

BT 205 BCE 70 20 10 30 10 10 150 3 1 2 6

Lab Plan
(BT205) Basic Computer Engineering

1. Study & Practice of Internal and External DOS command.


2. Study & Practice of Basic Linux commands.
3. Study & Practice of MS Windows.
4. Creation & Editing of text filter using MS-Word.
5. Creation & operating of Spreadsheet using MS-Excel.
6. Creation & Editing Power Point slider using MS-Power Point.
7. Study & Practice of Flowchart & Algorithm.

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

Computer Engineering) Lab Manual


ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

14. WAP to exchange value of two variable


i. Using third variable.
ii. Without using third variable.
15. WAP to convert
i. Temperature C to F ii. Temperature F to C
16. WAP to find the area of circle
17. WAP to find reverse of number (five-digit number).
18. WAP to find the sum of all digit of digit (five-digit number).

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

Computer Engineering) Lab Manual


ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

* 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

&&&&& 12345 ABCDE 12345 & &&&&&


&&&& 1234 ABCD 2345 && &&&&
&&& 123 ABC 345 &&& &&&
&& 12 AB 45 &&&& &&
& 1 A 5 &&&&& &

& &&&&&&&&& & &&&&&&&&&


&&& &&&&&&& &&& &&&& &&&&
&&&&& &&&&& &&&&& &&& &&&
&&&&&&& &&& &&&&&&& && &&
&&&&&&&&& & &&&&&&&&& & &
&&&&&&& && &&
&&&&& &&& &&&
&&& &&&& &&&&
& &&&&&&&&&
Array
44. WAP to demonstrate the array.
45. WAP to input number from user and display in an array.
46. WAP to sum n different numbers by array (find total marks secured by students in all subject).
47. WAP to search an element in an array.
48. WAP to print largest element of an array.
49. WAP to add two matrixes using multi-dimensional array.
50. WAP to multiply two matrixes using multi—dimensional array.

Functions
51. WAP for sum of two numbers using function.
52. WAP to swap values of two number using function

BT205 (Basic

Computer Engineering) Lab Manual


ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

i. Call by value ii.


Call by reference iii.
Call by address
53. WAP to find simple interest (float as return type).
54. WAP to access the value of variable through a pointer.
55. WAP to find factorial of a number using function (int return type).
56. WAP to print Fibonacci series using function.
57. WAP to find sum of first N natural number using recursion.
58. WAP to print Fibonacci series using recursion.
59. WAP to find factorial of number using recursion.

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.

Class and object


63. WAP to demonstrate the use of classes and objects.
64. WAP to add two numbers using member functions of a class and display the results.
65. WAP to demonstrate the use of scope resolution operators.

Constructor and destructor


66. WAP to display the concept of constructor & destructor.
67. WAP to Constructor overloading.

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

Computer Engineering) Lab Manual


ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

76. WAP to demonstrate the use of unary operator overloading.


77. WAP to demonstrate the use of binary operator overloading.
78. WAP to demonstrate the use of virtual function.

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

Computer Engineering) Lab Manual


ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

Name of Class: IT II Sem Name of Laboratory: BCE

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

Computer Engineering) Lab Manual


ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

Signature of Student

BT205 (Basic

Computer Engineering) Lab Manual


ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH,

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

BT205 (Basic Computer Engineering) Lab Manual


ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH,

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.

BT205 (Basic Computer Engineering) Lab Manual


ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH,

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.

BT205 (Basic Computer Engineering) Lab Manual


ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH,

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:

BT205 (Basic Computer Engineering) Lab Manual


ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, 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.

BT205 (Basic Computer Engineering) Lab Manual


ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, 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 5:
Creation and operating of spreadsheet using MS-Excel.

BT205 (Basic Computer Engineering) Lab Manual


ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, 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 6: Creation and editing power-point slides using MS- power point

BT205 (Basic Computer Engineering) Lab Manual


ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, 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 7:
Study & Practice of Flowchart & Algorithm.

BT205 (Basic Computer Engineering) Lab Manual


ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, 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 8:
WAP to print Hello World in C

//WAP to display Hello World in C


#include<stdio.h> int main()
{
printf("Hello world"); return 0;
}

Output:

Signature of student:

Experiment 9: WAP to print


Hello World in C++.

//WAP to display Hello World in C++


#include<iostream>
using namespace std;
int main()
{

BT205 (Basic Computer Engineering) Lab Manual


ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, 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:

cout<<"Hello world";
return 0;
}

Output:

BT205 (Basic Computer Engineering) Lab Manual


ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH,

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.

//WAP to print sum of two number.


#include<iostream>
using namespace std;
int main()
{
int a, b, sum=0; cout<<"\n Enter the 2
number:-";
cin>>a;
cin>>b;
sum=a+b;
cout<<"\n Sum of two number are :- "<<sum;
return 0;
}

Output:

BT205 (Basic Computer Engineering) Lab Manual


ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH,

INDORE

BT205 (Basic Computer Engineering) Lab Manual


ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH,

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.

//WAP to print sum of two number.


#include<iostream>
using namespace std;
int main()
{
int a; float
b; float sum=0;
cout<<"\n Enter the 2 number:-";
cin>>a>>b;
sum=(float) a+b;

BT205 (Basic Computer Engineering) Lab Manual


ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH,

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:

cout<<"\n Sum of two number are :- "<<sum;


return 0;
}

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;

BT205 (Basic Computer Engineering) Lab Manual


ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH,

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:

BT205 (Basic Computer Engineering) Lab Manual


ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH,

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:

BT205 (Basic Computer Engineering) Lab Manual


ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, 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 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);

total = computer + maths + English + physics + chemistry;


average = taotal/5;

printf(“ total marks = %.2f\n”,tatal);


printf(“ average marks = %.2f/n”, average);
return 0;
}
Output:

BT205 (Basic Computer Engineering) Lab Manual


ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, 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 14:
Write a Program to exchange value of two variables
i. Using third variable.

ii. Without 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;

cout<<” Before swapping; first number; “ << num1<<”second number; “<<num2;


temp = num1;
num1 = num2;
num2 = temp;

cout<<”\n after swapping ; first number ; “ <<num1<<” second number;”<<num2;


return 0;
}
Output:

BT205 (Basic Computer Engineering) Lab Manual


ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, 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:

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:

BT205 (Basic Computer Engineering) Lab Manual


ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, 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:

BT205 (Basic Computer Engineering) Lab Manual


ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, 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 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:

BT205 (Basic Computer Engineering) Lab Manual


ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

Name of Student: Gourav Askey 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:

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:

BT205 (Basic Computer Engineering) Lab Manual


ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, 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:

BT205 (Basic Computer Engineering) Lab Manual


ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, 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 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:

BT205 (Basic Computer Engineering ) Lab

Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

BT205 (Basic Computer Engineering ) Lab

Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, 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 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:

BT205 (Basic Computer Engineering ) Lab

Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

BT205 (Basic Computer Engineering ) Lab

Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, 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:

BT205 (Basic Computer Engineering ) Lab

Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, 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 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:

BT205 (Basic Computer Engineering ) Lab

Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

Name of Student: Prayag Parashar Class: IT-First Year


Enrollment No: Batch
Date of Experiment: Date of Submission: Submitted on:
Grade:
Signature of Faculty:

Experiment 19:
Write a Program to find maximum age among two students.

#include<stdio.h>

int main()
{
int student1, student2;

printf("Enter the age of student1, student2\n");


scanf("%d %d", &student1, student2);
printf("student1 = %d\t student2 =5d\n", student1, student2);
if ( student1 > student2)
{
if ( student1 > student2)
{
printf(" student1 is the bigger in age among two\n");
}
else
{
printf(" student2 is the bigger in age among two\n");
}
}

else if ( student2 > student1 )


printf(" student2 is the bigger in age among two \n");
return 0;
}
printf("num2 is the largest among two \n");
}

BT205 (Basic Computer Engineering ) Lab

Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

BT205 (Basic Computer Engineering ) Lab

Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

Name of Student: Prayag Parashar Class: IT-First Year


Enrollment No: Batch
Date of Experiment: Date of Submission:

Signature of Faculty:

Output:

BT205 (Basic Computer Engineering ) Lab

Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

Name of Student: Prayag Parashar Class: IT-First Year


Enrollment No: Batch
Date of Experiment: Date of Submission: Submitted on:
Grade:
Signature of Faculty:

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:

BT205 (Basic Computer Engineering ) Lab

Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

BT205 (Basic Computer Engineering ) Lab

Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

Name of Student: Prayag Parashar Class: IT-First Year


Enrollment No: Batch
Date of Experiment: Date of Submission:

Signature of Faculty:

BT205 (Basic Computer Engineering ) Lab

Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

Name of Student: Prayag Parashar Class: IT-First Year


Enrollment No: Batch
Date of Experiment: Date of Submission: Submitted on:
Grade:
Signature of Faculty:

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:

BT205 (Basic Computer Engineering ) Lab

Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

Name of Student: Prayag Parashar Class: IT-First Year


Enrollment No: Batch
Date of Experiment: Date of Submission:

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:

BT205 (Basic Computer Engineering ) Lab

Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

Name of Student: Prayag Parashar Class: IT-First Year


Enrollment No: Batch
Date of Experiment: Date of Submission: Submitted on:
Grade:
Signature of Faculty:

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

cout<<year<<" is a leap year";


}
else

cout<<year<<" is not a leap year";


return 0;
}

Output:

BT205 (Basic Computer Engineering ) Lab

Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

BT205 (Basic Computer Engineering ) Lab

Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

Name of Student: Prayag parasahar Class: IT-First Year


Enrollment No: Batch
Date of Experiment: Date of Submission:

Signature of Faculty:

BT205 (Basic Computer Engineering ) Lab

Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

Name of Student: Prayag Parashar Class: IT-First Year


Enrollment No: Batch
Date of Experiment: Date of Submission: Submitted on:
Grade:
Signature of Faculty:

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;

isLowercaseVowel = (n=='a' || n=='e' || n=='i' || n=='o' || n=='u');

isUppercaseVowel = (n=='A' || n=='E' || n=='I' || n=='O' || n=='U');

if(isLowercaseVowel || isUppercaseVowel)
cout<<n<<" is a vowel";
else
cout<<n<<" is a consonant";
return 0;
}

Output:

BT205 (Basic Computer Engineering ) Lab

Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

Name of Student: Prayag Parashar Class: IT-First Year


Enrollment No: Batch
Date of Experiment: Date of Submission:

Signature of Faculty:

BT205 (Basic Computer Engineering ) Lab

Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

Name of Student: Prayag Parashar Class: IT-First Year


Enrollment No: Batch
Date of Experiment: Date of Submission: Submitted on:
Grade:
Signature of Faculty:

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:

BT205 (Basic Computer Engineering ) Lab

Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

BT205 (Basic Computer Engineering ) Lab

Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

Name of Student: Prayag Parashar Class: IT-First Year


Enrollment No: Batch
Date of Experiment: Date of Submission:

Signature of Faculty:

BT205 (Basic Computer Engineering ) Lab

Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

Name of Student: Prayag Parashar Class: IT-First Year


Enrollment No: Batch
Date of Experiment: Date of Submission: Submitted on:
Grade:
Signature of Faculty:

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:

BT205 (Basic Computer Engineering ) Lab

Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

Name of Student: Prayag parasahar Class: IT-First Year


Enrollment No: Batch
Date of Experiment: Date of Submission:

Signature of Faculty:

cout << " Error! operator is not correct";


break;
}
return 0;
}

Output:

BT205 (Basic Computer Engineering ) Lab

Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

BT205 (Basic Computer Engineering ) Lab

Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

Name of Student: Prayag parasahar Class: IT-First Year


Enrollment No: Batch
Date of Experiment: Date of Submission: Submitted on:
Grade:
Signature of Faculty:

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;

isLowercaseVowel = (n=='a' || n=='e' || n=='i' || n=='o' || n=='u');

isUppercaseVowel = (n=='A' || n=='E' || n=='I' || n=='O' || n=='U');

if(isLowercaseVowel || isUppercaseVowel)
cout<<n<<" is a vowel";
else
cout<<n<<" is a consonant";
return 0;
}

Output:

BT205 (Basic Computer Engineering ) Lab

Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

Name of Student: Prayag Parashar Class: IT-First Year


Enrollment No: Batch
Date of Experiment: Date of Submission:

Signature of Faculty:

BT205 (Basic Computer Engineering ) Lab

Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

Name of Student: Prayag parasahar Class: IT-First Year


Enrollment No: Batch
Date of Experiment: Date of Submission: Submitted on:
Grade:
Signature of Faculty:

Experiment 28:
write a program to display day of week as user choice.
#include<iostream>
using namespace std;
int main()
{
int weeknumber;

cout<<"Enter weeknumber(1-7):- ";


cin>>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;
}

BT205 (Basic Computer Engineering ) Lab

Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

Name of Student: Prayag parasahar Class: IT-First Year


Enrollment No: Batch
Date of Experiment: Date of Submission:

Signature of Faculty:

Output:

BT205 (Basic Computer Engineering ) Lab

Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

Name of Student: Prayag parasahar Class: IT-First Year


Enrollment No: Batch
Date of Experiment: Date of Submission: Submitted on:
Grade:
Signature of Faculty:

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:

BT205 (Basic Computer Engineering ) Lab

Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

Name of Student: Prayag Parashar Class: IT-First Year


Enrollment No: Batch
Date of Experiment: Date of Submission:

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:

BT205 (Basic Computer Engineering ) Lab

Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

Name of Student: Prayag Parashar Class: IT-First Year


Enrollment No: Batch
Date of Experiment: Date of Submission: Submitted on:
Grade:
Signature of Faculty:

BT205 (Basic Computer Engineering ) Lab

Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

Name of Student: Prayag parasahar Class: IT-First Year


Enrollment No: Batch
Date of Experiment: Date of Submission:

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;

cout<<"\nList of Natural Number from "<< number << " to 0 are\n";


while(i>=0)
{
cout<<i<<" ";
i--;
}
return 0;
}

Output:

BT205 (Basic Computer Engineering ) Lab

Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

Name of Student: Prayag parasahar Class: IT-First Year


Enrollment No: Batch
Date of Experiment: Date of Submission: Submitted on:
Grade:
Signature of Faculty:

BT205 (Basic Computer Engineering ) Lab

Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

Name of Student: Prayag parasahar Class: IT-First Year


Enrollment No: Batch
Date of Experiment: Date of Submission:

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:

BT205 (Basic Computer Engineering ) Lab

Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

Name of Student: Prayag parasahar Class: IT-First Year


Enrollment No: Batch
Date of Experiment: Date of Submission: Submitted on:
Grade:
Signature of Faculty:

BT205 (Basic Computer Engineering ) Lab

Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

Name of Student: Prayag Parashar Class: IT-First Year


Enrollment No: Batch
Date of Experiment: Date of Submission:

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:

BT205 (Basic Computer Engineering ) Lab

Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

Name of Student: Prayag parasahar Class: IT-First Year


Enrollment No: Batch
Date of Experiment: Date of Submission: Submitted on:
Grade:
Signature of Faculty:

BT205 (Basic Computer Engineering ) Lab

Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

Name of Student: Prayag parasahar Class: IT-First Year


Enrollment No: Batch
Date of Experiment: Date of Submission:

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:

BT205 (Basic Computer Engineering ) Lab

Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

Name of Student: Prayag parasahar Class: IT-First Year


Enrollment No: Batch
Date of Experiment: Date of Submission: Submitted on:
Grade:
Signature of Faculty:

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:

BT205 (Basic Computer Engineering ) Lab

Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

Name of Student: Prayag parasahar Class: IT-First Year


Enrollment No: Batch
Date of Experiment: Date of Submission:

Signature of Faculty:

BT205 (Basic Computer Engineering ) Lab

Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

Name of Student: Prayag Parashar Class: IT-First Year


Enrollment No: Batch
Date of Experiment: Date of Submission: Submitted on:
Grade:
Signature of Faculty:

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:

BT205 (Basic Computer Engineering ) Lab

Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

Name of Student: Prayag parasahar Class: IT-First Year


Enrollment No: Batch
Date of Experiment: Date of Submission:

Signature of Faculty:

BT205 (Basic Computer Engineering ) Lab

Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

Name of Student: Prayag parasahar Class: IT-First Year


Enrollment No: Batch
Date of Experiment: Date of Submission: Submitted on:
Grade:
Signature of Faculty:

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;
}

BT205 (Basic Computer Engineering ) Lab

Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

Name of Student: Prayag parasahar Class: IT-First Year


Enrollment No: Batch
Date of Experiment: Date of Submission:

Signature of Faculty:

Output:

BT205 (Basic Computer Engineering ) Lab

Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

Name of Student: Prayag Parashar Class: IT-First Year


Enrollment No: Batch
Date of Experiment: Date of Submission: Submitted on:
Grade:
Signature of Faculty:

Experiment 38:
write a program to print number within range given by user.

BT205 (Basic Computer Engineering ) Lab

Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

Name of Student: Prayag Parashar Class: IT-First Year


Enrollment No: Batch
Date of Experiment: Date of Submission:

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:

BT205 (Basic Computer Engineering ) Lab

Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

Name of Student : Prayag parasahar Class: IT-First Year


Enrollment No: Batch
Date of Experiment: Date of Submission: Submitted on:
Grade:
Signature of Faculty:

BT205 (Basic Computer Engineering ) Lab

Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

Name of Student: Prayag parasahar Class: IT-First Year


Enrollment No: Batch
Date of Experiment: Date of Submission:

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:

BT205 (Basic Computer Engineering ) Lab

Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

Name of Student: Prayag parasahar Class: IT-First Year


Enrollment No: Batch
Date of Experiment: Date of Submission: Submitted on:
Grade:
Signature of Faculty:

BT205 (Basic Computer Engineering ) Lab

Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

Name of Student: Prayag parasahar Class: IT-First Year


Enrollment No: Batch
Date of Experiment: Date of Submission:

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);

printf("Prime numbers are:-\n");


for(i=2; i<=n; i++)
{
int c=0;
for(j=1; j<=i; j++)
{
if(i%j==0)
{
c++;
}
}
if(c==2)
{
printf("%d ",i);

BT205 (Basic Computer Engineering ) Lab

Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

Name of Student: Prayag parasahar Class: IT-First Year


Enrollment No: Batch
Date of Experiment: Date of Submission: Submitted on:
Grade:
Signature of Faculty:

}
}
}

Output:

BT205 (Basic Computer Engineering ) Lab

Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

Name of Student: Prayag parasahar Class: IT-First Year


Enrollment No: Batch
Date of Experiment: Date of Submission:

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:

BT205 (Basic Computer Engineering ) Lab

Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

Name of Student: Prayag Parashar Class: IT-First Year


Enrollment No: Batch
Date of Experiment: Date of Submission: Submitted on:
Grade:
Signature of Faculty:

BT205 (Basic Computer Engineering ) Lab

Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

Name of Student: Prayag Parashar Class: IT-First Year


Enrollment No: Batch
Date of Experiment: Date of Submission:

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:

BT205 (Basic Computer Engineering ) Lab

Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

Name of Student: Prayag parashar Class: IT-First Year


Enrollment No: Batch
Date of Experiment: Date of Submission: Submitted on:
Grade:
Signature of Faculty:

BT205 (Basic Computer Engineering ) Lab

Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

Name of Student: Prayag Parashar Class: IT-First Year


Enrollment No: Batch
Date of Experiment: Date of Submission:

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:

BT205 (Basic Computer Engineering ) Lab

Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

Name of Student: Prayag Parashar Class: IT-First Year


Enrollment No: Batch
Date of Experiment: Date of Submission: Submitted on:
Grade:
Signature of Faculty:

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:

BT205 (Basic Computer Engineering ) Lab

Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

Name of Student: Prayag Parashar Class: IT-First Year


Enrollment No: Batch
Date of Experiment: Date of Submission:

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:

BT205 (Basic Computer Engineering ) Lab

Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

Name of Student: Prayag Parashar Class: IT-First Year


Enrollment No: Batch
Date of Experiment: Date of Submission: Submitted on:
Grade:
Signature of Faculty:

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:

BT205 (Basic Computer Engineering ) Lab

Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

Name of Student: Prayag Parashar Class: IT-First Year


Enrollment No: Batch
Date of Experiment: Date of Submission:

Signature of Faculty:

BT205 (Basic Computer Engineering ) Lab

Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

Name of Student: Prayag Parashar Class: IT-First Year


Enrollment No: Batch
Date of Experiment: Date of Submission: Submitted on:
Grade:
Signature of Faculty:

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:

BT205 (Basic Computer Engineering ) Lab

Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

Name of Student: Prayag Parashar Class: IT-First Year


Enrollment No: Batch
Date of Experiment: Date of Submission:

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:

BT205 (Basic Computer Engineering ) Lab

Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

Name of Student: Prayag Parashar Class: IT-First Year


Enrollment No: Batch
Date of Experiment: Date of Submission: Submitted on:
Grade:
Signature of Faculty:

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:

BT205 (Basic Computer Engineering ) Lab

Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

Name of Student: Prayag Parashar Class: IT-First Year


Enrollment No: Batch
Date of Experiment: Date of Submission:

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:

BT205 (Basic Computer Engineering ) Lab

Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

Name of Student: Prayag Parashar Class: IT-First Year


Enrollment No: Batch
Date of Experiment: Date of Submission: Submitted on:
Grade:
Signature of Faculty:

BT205 (Basic Computer Engineering ) Lab

Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

Name of Student: Prayag Parashar Class: IT-First Year


Enrollment No: Batch
Date of Experiment: Date of Submission:

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:

BT205 (Basic Computer Engineering ) Lab

Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

Name of Student: Prayag Parashar Class: IT-First Year


Enrollment No: Batch
Date of Experiment: Date of Submission: Submitted on:
Grade:
Signature of Faculty:

BT205 (Basic Computer Engineering ) Lab

Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

Name of Student: Prayag Parashar Class: IT-First Year


Enrollment No: Batch
Date of Experiment: Date of Submission:

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:

BT205 (Basic Computer Engineering ) Lab

Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

Name of Student: Prayag Parashar Class: IT-First Year


Enrollment No: Batch
Date of Experiment: Date of Submission: Submitted on:
Grade:
Signature of Faculty:

BT205 (Basic Computer Engineering ) Lab

Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

Name of Student: Prayag Parashar Class: IT-First Year


Enrollment No: Batch
Date of Experiment: Date of Submission:

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:

BT205 (Basic Computer Engineering ) Lab

Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

Name of Student: Prayag Parashar Class: IT-First Year


Enrollment No: Batch
Date of Experiment: Date of Submission: Submitted on:
Grade:
Signature of Faculty:

BT205 (Basic Computer Engineering ) Lab

Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

Name of Student: Prayag Parashar Class: IT-First Year


Enrollment No: Batch
Date of Experiment: Date of Submission:

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:

BT205 (Basic Computer Engineering ) Lab

Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

Name of Student: Prayag Parashar Class: IT-First Year


Enrollment No: Batch
Date of Experiment: Date of Submission: Submitted on:
Grade:
Signature of Faculty:

BT205 (Basic Computer Engineering ) Lab

Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

Name of Student: Prayag Parashar Class: IT-First Year


Enrollment No: Batch
Date of Experiment: Date of Submission:

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<<" ";

for(int j=1; j<=i; j++)

cout<<j;

cout<<"\n";
}
}
Output:

BT205 (Basic Computer Engineering ) Lab

Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

Name of Student: Prayag Parashar Class: IT-First Year


Enrollment No: Batch
Date of Experiment: Date of Submission: Submitted on:
Grade:
Signature of Faculty:

BT205 (Basic Computer Engineering ) Lab

Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

Name of Student: Prayag Parashar Class: IT-First Year


Enrollment No: Batch
Date of Experiment: Date of Submission:

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:

BT205 (Basic Computer Engineering ) Lab

Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

BT205 (Basic Computer Engineering ) Lab

Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

Name of Student: Prayag Parashar Class: IT-First Year


Enrollment No: Batch
Date of Experiment: Date of Submission: Submitted on:
Grade:
Signature of Faculty:

BT205 (Basic Computer Engineering ) Lab

Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

Name of Student: Prayag Parashar Class: IT-First Year


Enrollment No: Batch
Date of Experiment: Date of Submission:

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:

BT205 (Basic Computer Engineering ) Lab

Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

BT205 (Basic Computer Engineering ) Lab

Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

Name of Student: Prayag Parashar Class: IT-First Year


Enrollment No: Batch
Date of Experiment: Date of Submission: Submitted on:
Grade:
Signature of Faculty:

BT205 (Basic Computer Engineering ) Lab

Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

Name of Student: Prayag Parashar Class: IT-First Year


Enrollment No: Batch
Date of Experiment: Date of Submission:

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:

BT205 (Basic Computer Engineering ) Lab

Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

Name of Student: Prayag Parashar Class: IT-First Year


Enrollment No: Batch
Date of Experiment: Date of Submission: Submitted on:
Grade:
Signature of Faculty:

BT205 (Basic Computer Engineering ) Lab

Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

Name of Student: Prayag Parashar Class: IT-First Year


Enrollment No: Batch
Date of Experiment: Date of Submission:

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:

BT205 (Basic Computer Engineering ) Lab

Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

BT205 (Basic Computer Engineering ) Lab

Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

Name of Student: Prayag Parashar Class: IT-First Year


Enrollment No: Batch
Date of Experiment: Date of Submission: Submitted on:
Grade:
Signature of Faculty:

BT205 (Basic Computer Engineering ) Lab

Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

Name of Student: Prayag Parashar Class: IT-First Year


Enrollment No: Batch
Date of Experiment: Date of Submission:

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:

BT205 (Basic Computer Engineering ) Lab

Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

BT205 (Basic Computer Engineering ) Lab

Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

Name of Student: Prayag Parashar Class: IT-First Year


Enrollment No: Batch
Date of Experiment: Date of Submission: Submitted on:
Grade:
Signature of Faculty:

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<<" ";
}

BT205 (Basic Computer Engineering ) Lab

Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

Name of Student: Prayag Parashar Class: IT-First Year


Enrollment No: Batch
Date of Experiment: Date of Submission:

Signature of Faculty:

for(j=1; j<=(r*2-(2*i-1)); j++)


{
cout<<"&";
}
cout<<"\n";
}
return 0;
}

Output:

BT205 (Basic Computer Engineering ) Lab

Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

BT205 (Basic Computer Engineering ) Lab

Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

Name of Student: Prayag Parashar Class: IT-First Year


Enrollment No: Batch
Date of Experiment: Date of Submission: Submitted on:
Grade:
Signature of Faculty:

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;;
}
}

BT205 (Basic Computer Engineering ) Lab

Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

Name of Student: Prayag Parashar Class: IT-First Year


Enrollment No: Batch
Date of Experiment: Date of Submission:

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<<"&";

BT205 (Basic Computer Engineering ) Lab

Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

Name of Student: Prayag Parashar Class: IT-First Year


Enrollment No: Batch
Date of Experiment: Date of Submission: Submitted on:
Grade:
Signature of Faculty:

}
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;

BT205 (Basic Computer Engineering ) Lab

Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

Name of Student: Prayag Parashar Class: IT-First Year


Enrollment No: Batch
Date of Experiment: Date of Submission:

Signature of Faculty:

for(m=0; m<=i; m++)


{
cout<<"&";
}
cout<<endl;
}
return 0;
}

Output:

BT205 (Basic Computer Engineering ) Lab

Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

Name of Student: Prayag Parashar Class: IT-First Year


Enrollment No: Batch
Date of Experiment: Date of Submission: Submitted on:
Grade:
Signature of Faculty:

Q44) write a program to demonstrate the array.


#include<iostream>
using namespace std;
int main()
{
int arr[]={10, 20, 30, 40, 50};
cout<<arr[0]<<endl;
cout<<arr[1]<<endl;
cout<<arr[2]<<endl;
cout<<arr[3]<<endl;
cout<<arr[4]<<endl;
return 0;
}

Output:

BT205 (Basic Computer Engineering ) Lab

Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

Name of Student: Prayag Parashar Class: IT-First Year


Enrollment No: Batch
Date of Experiment: Date of Submission:

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:

BT205 (Basic Computer Engineering ) Lab

Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

Name of Student: Prayag Parashar Class: IT-First Year


Enrollment No: Batch
Date of Experiment: Date of Submission: Submitted on:
Grade:
Signature of Faculty:

BT205 (Basic Computer Engineering ) Lab

Manual
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE

Name of Student: Prayag Parashar Class: IT-First Year


Enrollment No: Batch
Date of Experiment: Date of Submission:

Signature of Faculty:

BT205 (Basic Computer Engineering ) Lab

Manual

You might also like