0% found this document useful (0 votes)
12 views6 pages

Lab Question - Bhupendra Saud

Uploaded by

gaming0rascal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views6 pages

Lab Question - Bhupendra Saud

Uploaded by

gaming0rascal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Bhupendra saud

1. Write a program to display name of your college.


2. Write a program to find the distance between two points (x1, y1) and (x2,y2).Read
coordinate from user.
3. Write a program to find the circumference of a circle. [ Hint: c=2∏r ].
4. Write a program to use the use of typedef.
5. Write a program to illustrate the use of sizeof operator.
6. Write a program to find the ASCII values of various letters and digits.
7. Write a program to illustrate different format specifications for printing integer numbers,
real numbers and strings.
8. What are the control statements that are available in C language? Write a program to print
the larger and smaller number of two numbers.
9. Write a program to find whether given number is odd or even.
10. What do you mean by nested if statements? Write Syntax and draw the flow chart of nested
if statement. Write a program to find the largest number from three given numbers using
nested if statement.
11. Write a program to find the second largest number among any three numbers.
12. Write a program to find whether a year is leap or not.
Hint:
Read year
If(year%4==0)
{
If(year%100==0)
{
If(year%400==0)
Printf(“%d is leap year”,year);
Else
Printf(“%d is not leap year”,year);
}
Else
Printf(“%d is a leap year”,year);
}
Else
Printf(“%d is not leap year”,year);
}

13. Write a program to find the roots of a quadratic equation. Read coefficients from the users
and checks imaginary and real root.

1
Bhupendra saud

14. Differentiate between if….else and switch statements. Write a program that masks an
arithmetic operator and two operands and performs the corresponding operation on the
operands.
15. Write a program to find the value of y by reading value of x from the users by using
conditional operator.
2x+300 for x<50
Y = 200 for x=50
50x-100 for x>50
[Hint: y=(x!=50)?((x<50)?(2x+300):(50x-100)):200]

16. Why repetitive statements (loop) are used? List looping statements. Write a program to find
the multiplication of two numbers without using multiplication operator.
[Hint: using repetitive addition]
17. Write a program to find whether given number is prime or composite.
18. Write a program to find the sum of first n-natural numbers and then find average.
19. Write a program to read two integers n1 and n2. And display all even numbers between
those two numbers.
20. What is nested loop? Explain use of break and continue statements. Write a program to
print the prime numbers between 1 to 100.
21. Write a program to find HCF of any two numbers.
Hint:
Read a, b
do
{
r=a%b;
if(r==0)
printf(“HCF=%d”,b);
else
{
a=b;
b=r;
}
}while(r!=0);

22. Write a program to find LCM of any two numbers.


Hint:
Read x, y
a=x, b=y;
While (a!=b)
{
If(a<b) a=a+x
Else b=b+y
}
Print a as LCM.

2
Bhupendra saud

22. Write a program to find the sum of the digits of given number.
Hint:
While (n>0)
{
R=n%10;
S=S+R;
n/=10;
}

23. Write a program to find the products of the digits of any number.
24. Write a program to find reverse of given number.
25. Write a program to find whether a given number is palindrome or not.
26. Write a program to find binary equivalent of given decimal number.
Hint:
Read n
Base=1;
s=0;
while (n!=0)
{
R=n%2; s=s + r * base; base=base*10; n=n/2;
}

27. Write a program to convert the given binary number to its equivalent decimal number.
Hint:
Read n
J=1;
Dec=0;
While(n>0)
{
R=n%10;
Dec=Dec+r*j;
n/=10;
}
Print dec

28. Write a program to find whether given number is Armstrong number or not.
Hint: [371 is Armstrong number because 371=3 3+73+13=371]
29. Write a program to display Armstrong numbers between 100 to 1000.
30. Write a program to find sum of the square of all odd numbers from 1 to 100.
31. Write a program to find the factorial of given number.
32. Write a program to display the Fibonacci series (0, 1, 1, 2, 3, 5, 8, 13, 21, ……..) Read nth
term from the user using iteration.
Hint:
Read n
First=0;
Second=1;
While (term<n)
{
3
Bhupendra saud

Printf (“%d\t”, Term);


First=Second;
Second=Term;
Term=First + Second;
}

33. Write a program to find the sum of following series:


34. 1+2+4+7+11+16+………..up to n term.
35. Write a program to evaluate the expression: result=e (-0.1t) sin(0.5t) for t=0 n to 20 in interval
of 2.
Hint:
For(t=0;t<=20;t=t+2)
{
Result=(exp(-0.1*t)*sin(0.5*t));
Print Result;
}

36. Write a program to print the following pattern using nested loops.
*
* *
* * *
* * * *
* * * * *

37. Write a program to print the following pattern using nested loop.
*
* *
* * *
* * * *
* * * * *
* * * *
* * *
* *
*

38. Write a program to print the following pattern (Floyd’s Triangle) using nested loops
1
2 3
4 5 6
7 8 9 10
11 12 13 14 15

39. Write a program to print the Pascal triangle.


1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
4
Bhupendra saud

[Hint: Calculate power of 11 from 0 through 10]

40. Write a program to find the terms in the given series till the term value is less than 250
(12+22)/3, (22+32)/4, (32+42)/5, ………………………
Hint:
Term=0; i=1;
While(term<250)
{
Term=((i*i)+(i+1)*(i+1))/((float)(i+2));
Print Term;
i++;
}

41. Write a program to compute the following series (Euler’s number series)
1+ 1/1! + 1/2! + 1/3! +……………………+ 1/n!
Read n from user

5
Bhupendra saud

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy