C Assignment

Assignment-1 | printf () Statement

1. Develop C code to print “Your Name” and “Surname”  
2. Develop C code to clear the output screen and print “Welcome”.  
3. Develop C code to print “Hello World”, allow user to see output.  
4. Develop C Code to print the following in the center of screen.  


                     *********************  
                     |                |  
                     |     I am Star  |  
                     |                |  
                     *********************  

5. Develop C code to print your biodata.  
6. Develop C code that prints your name at the bottom-right line of the screen. 
7. Develop C code that demonstrates single & multiline comments.

Assignment-2 | scanf () Statement

(1) Enter the value of an integer variable and prints it on screen.
(2) Input a number, print its multiplication table up to 10.
(3) Input two numbers and prints its square and cube.
(4) Input two numbers and prints its Addition, Substraction, Multiplication,
     and Division.
(5) Verify the formula of Simple Interest.
(6) Input a Rupees and prints its value converted into Dollar.
(7) Input a Number of Chairs and its Total Cost and Prints the Cost of Each 
     chair.
(8) Verify the formula   l = (c+d)*(g+h).
(9) Verify the formula x = ((k-4)*(a*4))/100
(10) verify the formula s = ((4*a+c)-2*a*b)/100
(11) verify the formula  a = p*(1+(r/100)/n)-p
(12) Verify the formula t = ((v+s)+(l-m)*l)
(13) Calculate the area of circle.
(14) Calculate the area of Triangle.
(15) Verify the formula c = (a+b)*(a+b)

Assignment-3 | if else Statement

(1) Input 1 number, check whether it is less, equal or greater than zero.  
(2) Input 2 number and print the maximum among them.  
(3) Input 2 numbers and print the maximum among them.(without If statement)  
(4) Input 2 numbers and print the minimum among them.  
(5) Input 2 number and print the minimum among them. (without If statement)  
(6) Input 3 numbers and print the maximum among them.  
(7) Input the age of 5 students and print the number of students with an age less than or equal to 21 and greater than 21.  
(8) Input 3 subject marks, calculate total, average and grade.  
(9) Write a program to perform the arithmetic operation of two numbers. Allow the user to decide the arithmetic operation at runtime.
(10) Input a number & print whether the number is odd or even.  
(11) Input a character in lower case, and display it in upper case.  
(12) Input a character, print whether the character is a vowel or consonant.     
(13) Input 1 number (day number of week), print day name of given day number.  
(14) Write the above program using the switch case statement.  
(15) Input 1 number (month number of the year); print the month name of given month number.  
(16) Write above program using switch case statement.

Assignment-4 | Looping Structure (while, do…while, for)

(1) print 1 to 10
(2) print 2,4,6,8,10
(3) print 1,3,5,7,9.
(4) print 1,2,4,8,16,32,64
(5) print 10 to 1
(6) print 1,10,2,9,3,8,4,7,5,6
(7) print 2,11,20,28,25,41,46,50,53,55,56
(8) print first 100 even number.
(9) print first 100 odd number.
(10) print first 50 natural number.
(11) print the total of 1 to 50.
(12) print the total of 1/2+2/3+….+9/10.
(13) print the total of 1-2+3-4+5-6+7-8+9-10.
(14) print the total of first 100 even numbers.
(15) print the total of first 100 odd numbers.
(16) 0.1+0.02+0.003+0.0004+0.000005.
(17) Accept one number from user and display Reverse of it.
(18) Accept one number from user and display sum of its digits.
(19) Accept one number from user and display its factorial.
(20) Accept one number from user and find if it is prime or not.
(21) Accept one number from user and find if it is Armstrong or not.
(22) Print 0 1 1 2 3 5 8 13 21 34 55 … up to n (Fibonacci series)

Assignment-5 | Nested Looping Structure

Pattern-IPattern-IIPattern-III
*
**
***
****
*****
*
**
***
****
*****
*
**
***
****
*****
12345
12345 
12345
12345
12345
11111
22222
33333
44444
55555
1  2  3   4   5
2  4  6   8   10
3  6  9   12 15
4  8  12 16  20
5  1015  20 25
A A A A A
B B B  B B
C C C C C
D D D D D
E  E E  E E
1
22
333
44444
555555
1
12
123
1234
12345
5
54
543
5432
54321
1
21
321
4321
54321
1
2  3
4  5  6
7  8  9  10
1112131415
1
01
010
1010
10101
1
10
101
1010
10101
a
b c
d e f
g h i j
k l m n o
A
bb
ccc
dddd
eeeee
z
y  x
w v u
t   s  r q
p  o n m l
1
10
100
1000
10000
5
45
345
2345
12345
Implement all above program with Pattern-II & Pattern-III
12345
1234
123
12
1
12345
2468
369
48
5
54321
5432
543
54
5
54321
4321
321
21
1
12345
2345
345
45
5
55555
4444
333
22
1
2 4 6 8 10
4 6 8 10
6 8 10
8 10
10
a b c d e
b c d e
c d e
d e
e
Implement all above program with Pattern-I & Pattern-II

Assignment – 6 | Array & Pointers

  1. Develop a program to accept 5 numbers in an array and display it.
  2. Develop a program to accept N number in an array, display it in reverse order of index.
  3. Develop a program to accept numbers for M Rows and N Columns for in 2-D Array, display it.
  4. Develop a program to accept 9 numbers in the form of matrix. (3 x 3 matrix)
  5. Develop a program to accept 10 numbers in an array and store it in another array.
  6. Develop a program to accept 10 numbers in an array and find total of positive and negative number.
  7. Develop a program to accept N numbers in an array and…
    a. calculate and display total of all numbers
    b. calculate average of total and display
    c. find the minimum number and display
    d. find maximum number and display
  8. Develop a program to demonstrate the concept of pointer.
  9. Develop a program to swap two values (pass by reference).
  10. Develop a program to demonstrate pointer to array.
  11. Develop a program to demonstrate pointer to structure

Assignment 7 | User defined functions (UDF)

(01) Create a user define function named sum which accept 2 arguments (of integer type) and return the sum of them.
(02) Create a user define function named avg which pass array as argument (of integer type) and return its average value.
(03) Create a user define function named evenodd which accept one argument (of integer type) and return if the number is even or odd.
(04) Create a user define function named fact which accept one argument (of integer type) and return the factorial of given number.
(05) Create a user define function named prime which accept one argument (of integer type) and display that the no is prime or not. (no need to return value)
(06) Create a user define function named triangle which accept one argument (of integer type) and display the following triangle. (assuming, 4 is the given argument) 1
12
123
1234
(07) Create a user define function named power which accept two argu- ments (of integer type) (i) base (ii) expon and display the base expon value.
(08) Create a user define function named Sroot which accept one argument (of integer type) and display the square root of that no.
(09) Create a user define function named ASCII which accept one argument (of character type) and display ASCII value of that character.
(10) Create a user define function named CHR which accept one argument (of integer type) and display character of that ASCII value.

Assignment 8 | Built in functions (library functions)

  1. Accept one no and display its absolute value.
  2. Accept one no and display its log.
  3. Accept one no and display its square root.
  4. Get 2 no from user and display base^exp. (2^3=8)
  5. Get a string from user and display length of that string.
  6. Get a string from user and copy it in another variable.
  7. Get two strings from user and compare weather both are same or not.
  8. Get a string from user and display reverse of it.
  9. Get two strings from user and merge it into first string.
  10. Get a string from user and display it in lower case.
  11. Get a string from user and display it in upper case.

Assignment 9 | Structure & Union

  1. Develop for the following structure to read the value for roll no, name, m1, m2, m3. Calculate sum, average and grade.
    struct Student
    {
    int roll_no, m1, m2, m3, sum;
    float average;
    char name [15], grade;
    };
  2. Develop for the following structure to read the value for employee no, employee name, basic salary, DA, HRA, TA, PF. Calculate the Gross Salary.
    struct Emp
    {
    int emp_no;
    float basic_salary, DA, HRA, TA, PF, Gross_Salary
    char emp_name [15], grade;
    };
  3. Demonstrate array of structure for the above Student structure.
  4. Demonstrate array of structure with pointers for above Emp structure.
  5. ture. Develop C program to identify the size of both Student & EMP struc-
  6. Develop C program to demonstrate structure within a structure (nested structure).
  7. Develop C program to demonstrate the Union.
  8. Develop C program to demonstrate UDF with structure variable as