Sie sind auf Seite 1von 11

Lab # 1

1. Write a program that will print the mailing address in the


following form

i) First line : Name

Second Line : Door No, Street

Third Line : City

ii) *

* *

* * *

* * * *

* * * * *

2. Write a program that takes value a,b,c from keyboard &


calculate as x=b/(a-c)

3. write a program to find out the root for the equation


ax2+bx+c=0 using that

x=(-b)+-(b2-4ac).5/2a

4. calculate the cosine angle for the different value of angle as

pi=3.1416 ; max=180

x=(pi/max)*angle , y=cos(x);

5. Calculate the circle area using the following formula area=pi*r2


Lab # 2
IF-else
1. takes a value from keyboard & determine either it is below or above
100

sample input & 0utput:

78

below 100

103

above 100

2.Takes a value from keyboard & determine either it is odd or even

sample input & output:

55

odd number

26

even number

3. Write down a program to find either two value equal or find the
large value.

4. Write down a program to find the largest among three value.

5.Write a program to check whether an alphabet is Vowel or


consonent.
Lab # 3(Odd)

1.Write a program that takes a character from keyboard & show it in reverse
order as if it is in Uppercase , then show in lowercase & vise-versa

2.Write a C Program to create a simple calculator for addition, subtraction,


multiplication and division

3. Write a program to find the number of digit in an integer

4. Write a program to evaluate the power series as

ex =1+x+x2/2!+x3/3!+.......+xn/n!

5. Write a program to find out the value of the expression as

y=xn

for a given value of x & n.

6.Write a program that takes a number & find out either it is palindrome or
not.

input: 12121

output : palindrome

7. Write a program using while loop to reverse the digit of the number as

input :12345

output :54321

8.Write a program that takes a positive integer value & convert it in binary
equivalent

9. Write a program that takes a Binary value & convert it in decimal


equivalent

10. Write a program that prints the fibonacci series as

1 1 2 3 5 8 13 21.....& so on
Lab # 4(Even)

1. Write a program to determine the sum of the harmonic series for a


given value of n

1+1/2+1/3+1/4+......+1/n

2.Write a program to determine the factorial of the given value.

3. Write a program to find the Greatest Common Divisor(GCD) of


Highest Common Factor(HCF) of two value.

4. Write a program to find the Least Common Multiple(LCM) of two


value.

5. Write a program to find the number of and sum of all integers


greater than 100 and less than 200 that are divisible by 7

6.Write a program that takes a number & find out either it is


palindrome or not.

input: 12121

output : palindrome

7. Write a program using while loop to reverse the digit of the number
as

input :12345

output :54321

8.Write a program that takes a positive integer value & convert it in


binary equivalent

9. Write a program that takes a Binary value & convert it in decimal


equivalent

10. Write a program that prints the fibonacci series as

1 1 2 3 5 8 13 21.....& so on
Lab # 4(ODD)

1. Write a program to determine the sum of the harmonic series for a


given value of n

1+1/2+1/3+1/4+......+1/n

2.Write a program to determine the factorial of the given value.

3. Write a program to find the Greatest Common Divisor(GCD) of


Highest Common Factor(HCF) of two value.

4. Write a program to find the Least Common Multiple(LCM) of two


value.

5. Write a program to find the number of and sum of all integers


greater than 100 and less than 200 that are divisible by 7
Lab # 5(Odd)
1Illustrate the program in the following from of Floyd’s triangle.
1
01
101
0101
10101
2.Illustrate the following form according to C program
a)
1
2 2
3 3 3
4 4 4 4
b)
* * * * *
* * * *
* * *
* *
*
3. Evaluate The Expression

e= 1+1/1!+1/2!+1/3!+...............1/n!

4.Write a program that uses a one dimensional array x to read the


values & compute the sum of their squares.

5.Write a program that takes 50 marks of students in a class & count


the number of students to each of the following groups of marks as:

0-9,10-19,20-29.....100

6.Write a program that prints a multiplication table using two


dimentional array as

1 2 3 4 5

1 1 2 3 4 5

2 2 4 6 8 10

3 3 6 9 12 15
4 4 8 12 16 20

5 5 10 15 20 25

7. An election is contested by 5 candidates. The candidates are


numbered 1 to 5 and the voting is done by marking the candidate
number on the ballot paper. Write a program to read the ballots and
count the votes cast for each candidate using an array variable count.
In case a number read is outside the range 1 to 5 ballot should be
considered as a spoilt ballot and the program should also count the
number of spoilt ballots.

8.The annual examination results of 100 students are tabulated as


follows:

Roll No: Subject 1 Subject 2 Subject 3

Write a program to read the data and determine the following :


(a)Total marks obtained by each student.
(b)The highest marks in each subject and the roll no. of the student who
secured it
(c) The student who obtained the highest total marks.
Lab # 6 (even)
1. Write a program that takes a line of string as input & print it in
output.

2.Write a program that takes an employee's first_name , middle_name


& last_name & add it in a string.

3. Write a program that takes a string as input & extract a portion of


the string.

sample input: students


output : dent
4.Write a program that takes a string & determines the blank space of
the line & put an alphanumeric character in it as
input: hello ict students ?
output: hello@ict@students@?
5.Write a program that takes a string as input & print it in that
manner?
input:hello ict students ?
output:
hello
ict
students
?
6. Write a program that takes input "Cprogramming" as input & print it
in the following format as
C
Cp
Cpr
..............
Cprogramming
Cprogramming
......................
Cpr
CP
7.Write a program that takes a line of string & determine which
character occur in how many times as

hello ict students ?

h occur in 1 times

e occur in 2 times

& so on.

8.Write a program that takes input as


char str[ ]= “123456789”;
displays in the following:
1
232
34543
4567654
567898765

9.Write a program that takes a string & makes output in reverse order as
sample input: good
output: doog
******************User Defined Function*******************
1. Write a program using user define function to print a line using "-"
character before a text & after a text.
2. Write a program using user define function that can multiply two
value & return to main function.
3. Write a program using user define function that takes a value from
keyboard & find out its factorial.
4.Write a program that illustrate pass by value with associate
example.
5. Write a program that illustrate pass by reference with associate
example.
6. Write a program that takes a set of values using array & sort them
in ascending order.
7. Write a program that illustrates an example of automatic variable.
8.Write a program that illustrates the characteristics of a static
variable.
9.Write a program to calculate the standard deviation of an array of
values. The array elements are read from the terminal. Use function to
calculate standard deviation & mean

𝑛
S.D=√1/n ∑ ̅ − Xi)2
(X
𝑖=0

10.Use recursive function calls to evaluate


𝑥3 x5
f(x)=𝑥 − + −⋯
3! 5!

11. The fibonacci numbers are defined recursive as follows


F1=1
F2=1
Fn=Fn-1+Fn-2 , n>2
Write a function that will generate & print first n numbers.

Das könnte Ihnen auch gefallen