Assignment 1, Exercises for Computer Engineering and Programming. West Bengal University of Technology
riktom_roy
riktom_roy12 May 2016

Assignment 1, Exercises for Computer Engineering and Programming. West Bengal University of Technology

PDF (359 KB)
8 pages
409Number of visits
Description
very helpful to u
20 points
Download points needed to download
this document
Download the document
Preview3 pages / 8

This is only a preview

3 shown on 8 pages

Download the document

This is only a preview

3 shown on 8 pages

Download the document

This is only a preview

3 shown on 8 pages

Download the document

This is only a preview

3 shown on 8 pages

Download the document
 EXPERIMENT No

College of Engineering & Management, Kolaghat

DEPARTMENT OF INFORMATION TECHNOLOGY

BCPCP

LABORATORY

LAB ASSIGNMENT

Doc No.: CEMK/IT/CS291/01

Revision No.: 1.0

Page1 of 7

College of Engineering and Management, Kolaghat

Multimedia Laboratory, (Spring Semester, 2014, IT)

Assignment-1

The objective of this assignment is to learn how to write C program using different operators 1. Mr. Sayan Ghosh is an employee of an Engg. College. His Basic is Rs. 8825/- . Now the dearness allowance

is 40% of his basic salary and house rent allowance is 20% of basic salary. Write a program to calculate his

gross salary.

2. [Though his basic salary is 8825/- Do this program where basic is taken through keyboard].

3. Write a C program to take two integer numbers for addition,subtraction,multiplication & type casting division

and display them on the screen.

4. The length and breadth of a rectangle and radius of a circle are input through keyboard. Write a program to

calculate the area and perimeter of the rectangle,and the area and the circumference of the circle.

5. Temperatures of a city in Fahrenheit degree is input through a keyboard. Write a program to convert the

temperature into centigrade degrees.

6. Two numbers are input through a keyboard into two locations. Write a program to interchange the contents of

the two variables. Again do the same problem without using a third variable.

7. If a three digits number is input through a keyboard then write a program

i)To calculate the sum of digits.

ii)To calculate the sum of the last two digits.

iii)To reverse the number.

8. Write a program to take co-ordinates of two points then display the distance between these

two points using sqrt( ) & pow( ) functions.

College of Engineering & Management, Kolaghat

DEPARTMENT OF INFORMATION TECHNOLOGY

BCPCP

LABORATORY

LAB ASSIGNMENT

Doc No.: CEMK/IT/CS291/01

Revision No.: 1.0

Page1 of 7

Assignment-2

The objective of this assignment is to learn how to write conditional statements using a)If Else condition

b)If Else If condition and how to use logical operators.

1. Write a program to find whether a number is odd or even.

2. A year is input through a keyboard.Write a program to determine whether the year is leap year or not.

3. Write a program which converts a character into its lowercase letter if it is in uppercase and to its uppercase

letter if it is lowercase letter.

4. Write a program to determine whether a character is a digit or not.

5. Write a program to check whether a number and its corresponding reverse number is equal or not.

6. Write a program to find the maximum and minimum of the three numbers.

7. Write a program to find all roots of a quadratic equation.

8. A student's grade is calculated in a subject according to the following rules:

Number obtained Grade

>=90 O

>=80 and <90 E

>=70 and <80 A

>=60 and <70 B

>=50 and <60 C

>=40 and <50 D

<40 F(FAILED)

Write a program which accepts a student's number as input and then determine the

grade of the students in that subject.

College of Engineering & Management, Kolaghat

DEPARTMENT OF INFORMATION TECHNOLOGY

BCPCP

LABORATORY

LAB ASSIGNMENT

Doc No.: CEMK/IT/CS291/01

Revision No.: 1.0

Page1 of 7

Assignment-3

Objective: (No. of labs 2) The main objective of this assignment is to learn how to write a loop statement using either

a. for loop

b. while loop or

c. do-while loop

1. Write a program to calculate the factorial value of a given number.

2.Write a program to find the power of a given number.

( Example : (m)^n => mand n are two integers.)

3.Write a C program to find the G.C.D and L.C.M of any two integer numbers .

4.W rite a C program to check whether the given number is Peterson or not using.

5.Write a C program to display all prime numbers within the range(which is given by the user) .

6.Write a C program to check whether a given number is palindrome or not .

7.Write a C program to calculate the sum of the following series :

i) S = 1 -2 + 3 -4 +5 -…………N terms.

ii) S= 1/2 + 3/4 + 5/6 + 7/8 + ……N terms

iii) S= 1*2^3 +2*3^3 + 3*4^3 + ……N terms

8.Write a program which prints the pascal triangle.

9.Write a program to display the below triangles.(different form given by the faculty)

College of Engineering & Management, Kolaghat

DEPARTMENT OF INFORMATION TECHNOLOGY

BCPCP

LABORATORY

LAB ASSIGNMENT

Doc No.: CEMK/IT/CS291/01

Revision No.: 1.0

Page1 of 7

Assignment-4

The objective of this assignment is to learn how to write function 1. Write a C program to calculate the sum of any two numbers using 4 different patterns of user defined

functions.

2. Write a C program to swap two integer numbers using call by value.

3. Write a C program to display the area of a circle using static function area( ) which will be called inside the

display function dis( ) for 3 times.

4. Write a C program to implement recursive functions:

i) G.C.D of two numbers

ii) Fibonacci series of N terms.

5.Write a C program to calculate the sum [S = A + 3*B] using macro.

6.Write a C program using recursive factorial function to calculate nCr where n and r are given as

inputs.

7.Write a C program which contains a conversion function that converts an decimal number into

its corresponding octal number.

College of Engineering & Management, Kolaghat

DEPARTMENT OF INFORMATION TECHNOLOGY

BCPCP

LABORATORY

LAB ASSIGNMENT

Doc No.: CEMK/IT/CS291/01

Revision No.: 1.0

Page1 of 7

Assignment-5

Objective: The objective of this assignment is to learn

a) How to use array ( both 1-D and 2-D ).

b) How to pass an array to a function.

1. Write a program to display all the 1-D array elements from starting index to last index and vice versa. Array

length & elements will be supplied by the user.

2. Write a program to insert one element into any position of the existing 1 –D array. Finally display the

resultant array which containing one extra element with previous all elements.

3. Write a program to delete one element from any position of the existing 1-D array. Finally display the

resultant array.

4. Write a program to search a given number from the 1-D array whether this number is present or not using

Linear Search Technique.

5. Write a program to multiply two 2-D matrixes and display the resultant matrix. Also mention the matrix

multiplication conditions.

6. Write a program to calculate the sum of each row and column of a given 2-D matrix. Also

calculate the sum of main diagonal and other diagonal of this matrix.

7. Write a program to search a given number from the sorted 1-D array whether this number is

8 Write a C program which finds the maximum and minimum number from a given set of integer

numbers taken in an array.

9. Write a C program to take a number of integers and then sorted them in both increasing and

decreasing order.

[ NOTE: Write a program to sort all the array elements using Bubble sort, Insertion sort and

Selection sort Technique. “ If time permits “ ]

College of Engineering & Management, Kolaghat

DEPARTMENT OF INFORMATION TECHNOLOGY

BCPCP

LABORATORY

LAB ASSIGNMENT

Doc No.: CEMK/IT/CS291/01

Revision No.: 1.0

Page1 of 7

Assignment-6

Objective: The objective of this assignment is to learn how we can manipulate strings in different way and

how to use pointer.

1. Write a program to check whether a given string is palindrome or not. Also display the reverse of the given

string.

2. Write a program to count total number of vowels , consonants and spaces from the given string.

3. Write a program to merge 2nd string at the end of 1st string without using strcat() function.

4. Write a program to copy a string into another string without using strcpy() function.

5. Write a program to compare the two strings without using strcmp() function.

IF TIME PERMIT

6. Write a C program to find the frequency of each character of a given string.

7. Write a C function to remove all the repeated characters from a given string.

Pointer: 1. Write a program to display the entire array elements from starting index to last index and

viceversa using pointer.

2. Write a program to add 1 with each array element using pointer then display all the array

elements with the help of pointer.

3. Write a program to search a given number from the array whether this number is present or

not using Linear Search Technique with the help of pointer.

4. Write a program to add two square matrixes and display the resultant matrix using pointer.

College of Engineering & Management, Kolaghat

DEPARTMENT OF INFORMATION TECHNOLOGY

BCPCP

LABORATORY

LAB ASSIGNMENT

Doc No.: CEMK/IT/CS291/01

Revision No.: 1.0

Page1 of 7

Assignment-7

Objective: The objective of this assignment is to learn how to use structure and file

1. Write a program of a student structure which consists of 4 members( Sname , Sroll, Saddress and Sph_no).

Using this structure take 4 different student information then display all the information using structure variable

with the help of dot(.) and arrow(->) operators.

2. Write a program of a employee structure which consists of 4 members( Ename , Ecode, Esal and Eph_no).

Using this structure take 5 different employees information then display all the information of all employees

after sorting all information according to salary in ascending order.

3. Write a program of a person structure which consists of 4 members (Pname , Pcode, Paddress and Psal).

Using this structure take 5 different person information.

If the person earning salary in between Rs.1000 to Rs.3500 then add Rs.500 to the salary of that person. Finally

display all the information using structure variable after modification.

4. Write a program to open a text file in read mode then write all information from that file after

reading into another text file. Finally read all information from the 2nd text file using read

mode.

5. Write a program to open a text file in write mode then write some information into that file.

Finally count total number of characters and spaces from that text file.

6. Write a program to open a binary file in read mode then write all information from that file after

reading into another binary file. Finally read all information from the 2nd binary file using read

mode.

College of Engineering & Management, Kolaghat

DEPARTMENT OF INFORMATION TECHNOLOGY

BCPCP

LABORATORY

LAB ASSIGNMENT

Doc No.: CEMK/IT/CS291/01

Revision No.: 1.0

Page1 of 7

comments (0)

no comments were posted

be the one to write the first!

This is only a preview

3 shown on 8 pages

Download the document