Skip to content

CSE101 & 102 courses - department of Machinery Design & Maintenance (MDM)'s theory & lab programming exercise, classwork, assignments(A), problem solving(PSv) & projects.

License

Notifications You must be signed in to change notification settings

ArnobMahmud/CSE101-PSvA

Repository files navigation

CSE101-PSvA

CSE101 & 102 courses - department of Machinery Design & Maintenance (MDM)'s theory & lab programming exercise, classwork, assignments, problem solving & projects. C/C++ Problem Solution by Arnob Mahmud.

  develop-with-arnob  made-with-c
wakatime

Weekly analyzed topics 👍🏻

  • Intro
  • Syntax
  • Data Types
  • Operators
  • Conditions
  • Loops
  • Array
  • Function
  • String
  • Pointer

Problem Solving

1.Write a c program to calculate the sum of two numbers.
2.Write a c program to calculate the average of three numbers.
3.Write a c program to calculate the area of a triangle using 1/2 * base * height.
4.Write a c program to calculate the area of a triangle using three sides.
5.Write a c program to calculate the area of a rectangle.
6.Write a c program to calculate the area of a circle.
7.Write a c program to convert Celsius temperature to Fahrenheit temperature.
8.Write a c program to convert Fahrenheit temperature to Celsius temperature.
9.Write a c program to swap two numbers.
10.Write a c program to ceil, round, and floor a floating-point number.

2.Write a c program to check whether a number is even or odd.
3.Write a c program to check whether a number is positive or negative or equal to zero.
4.Write a c program to find the largest between two numbers.
5.Write a c program to find the smallest among three numbers.
6.Write a c program to check whether a year is a leap year or not.
7.Write a c program to check whether a student has passed (40%) or failed from a given mark.
8.Write a c program to calculate the grade points of a student for a particular subject from the given mark using the following table:
90% and above 4.0
80% to below 90% 3.5
70% to below 80% 3.0
60% to below 70% 2.5
50% to below 60% 2.0
Below 50% 0.0

9.Write a c program to check whether a character is a capital letter or a small letter or others.
10.Write a c program to check whether a character is a vowel or consonant or digit or white space or special character.
12.Write a c program to spell a digit using switch.
13.Write a c program to check whether a character is vowel or consonant using switch.
14.Write a c program to implement a calculator (+, -, *, /, %) using switch.
15.Write a c program to implement a menu based temperature conversion using switch.

1.Answer the following questions with appropriate examples and flowcharts:
(a) How does a for loop work?
(b) How does a while loop work?
(c) How does a do-while loop work?
(d) How does the goto statement work?
(e) How does the break statement work?
(f) How does the continue statement work?

2.Write a c program to print the sum of the following series:
(a) 1 + 2 + 3 + . . . . + N
(b) 1^2 + 3^2 + 5^2 + . . . . + N^2
(c) 2^2 * 4^2 * 6^2 * . . . . * N^2
(d) 1 + 1/2 + 1/3 + . . . . + 1/N
(e) 1 - 2 + 3 - 4 + 5 - 6 + . . . . + N
(f) 1 * 2 + 2 * 3 + 3 * 4 + . . . . + n1 * n2
(g) 1 * 3 * 4 + 2 * 5 * 6 + 3 * 7 * 8 + . . . . + n1 * n2 * n3
(h) 1 + 5 + 9 + . . . . + Nth number
(i) 1 + 2 + 4 + 5 + 7 + 8 + . . . . + N
(j) 60 + 57 + 54 + . . . . >=1

3.Write a c program to calculate the sum of the Fibonacci series upto N-th term:
0 + 1 + 1 + 2 + 3 + 5 + 8 + . . . . + Nth term

4.Write a c program to calculate the factorial of a number.
5.Write a c program to calculate the GCD and LCM of two numbers.
6.Write a c program to check whether a number is prime or not.
7.Write a c program to print the prime numbers within a range.
8.Write a c program to count the number of digits of a number.
9.Write a c program to calculate the sum of digits of a number.
10.Write a c program to reverse a number.
11.Write a c program to check whether a number is a palindrome or not.
12.Write a c program to print the palindrome numbers within a range.
13.Write a c program to check whether a number is an Armstrong number or not.
14.Write a c program to print the Armstrong numbers within a range.
15.Write a c program to check whether a number is a Strong number or not.

1.Write a c program to calculate the sum and average of an array.
2.Write a c program to find both values and indexes of maximum and minimum elements of an array.
3.Write a c program to search a number in an array. It will print the index of the element, if it is found. Otherwise, it will print “Not found.”
4.Write a c program to count the frequency of a number in an array.
5.Write a c program to copy an array to another array.
6.Write a c program to reverse an array.
7.Write a c program to sort an array.
8.Write a c program to calculate the sum and average of a 2D array.
9.Write a c program to find both values and indexes of maximum and minimum elements of a 2D array.
10.Write a c program to calculate the sum of diagonal elements of a matrix.
11.Write a c program to multiply a matrix by a factor.
12.Write a c program to transpose a matrix, i.e., A’. Given, A = {{1, 2}, {2, 4}}.
13.Write a c program to add two matrices. If A and B are two matrices, the sum of these matrices, C = A + B.
14.Write a c program to subtract two matrices. If A and B are two matrices, the difference of these matrices, C = A - B.
15.Write a c program to multiply two matrices. If A and B are two matrices, the product of these matrices, C = A * B. Given, A={{1, 2}, {1, 2}} and B = {{2, 1}, {2, 1}}.

1.Write a c program to search for a character in a string. It will print the index of the element, if it is found. Otherwise, it will print “Not found.”
2.Write a c program to count the frequency of a character in a string.
3.Write a c program to count the number of capital letters and small letters in a string.
4.Write a c program to count the number of vowels, consonants, digits, white-spaces, and special characters.
5.Write a c program to count alphanumeric characters in a string. Note that alphanumeric characters are a combination of alphabetic and numeric characters. Your program will print 8 for this string "".
6.Write a c program to calculate the length of a string.
7.Write a c program to add three strings.
8.Write a c program to copy a string to another string.
9.Write a c program to reverse a string.
10.Write a c program to check whether a string is a palindrome or not.

2.How does function work?
3.Write a c function that takes two numbers as parameters and returns the sum of them.
4.Write a c function that takes a year as a parameter and returns 1 if it is a leap year, otherwise, it returns 0. It will return 1 for 2000 and 0 for 2100.
5.Write a c function that takes mark of a subject as parameter and returns obtained grade.
6.Write a c function that takes a number as a parameter and returns 1 if it is prime, otherwise, it returns 0. It prints 1 for 23 and 0 for 22.
7.Write a c function that takes an array as a parameter and returns the average of that array.
8.Write a c function to check whether a string is a palindrome or not. It returns 1 if given string is a palindrome, otherwise, it returns 0. A string is called palindrome if the reverse of the string is the same as the original string, i.e., madam. You can use library functions.
9.Write a c function to calculate the factorial of a number using recursion.
10.Write a c function to calculate the sum of the multiples of 7 within 1 to 100, i.e., 7+14+21+...+98, using recursion. It will print 735.
11.Write a c function to swap two numbers using pointer.

About

CSE101 & 102 courses - department of Machinery Design & Maintenance (MDM)'s theory & lab programming exercise, classwork, assignments(A), problem solving(PSv) & projects.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages