CPU Programs

Spread The Knowledge 😌

INSTRUCTIONS

  • This is a program list, you have to follow this way which is below.
  • You can include both programs and assignment in one file, so no need to make separate file for each.
  • Each program should be starts with new page.
  • For the programs you have to use single side page but assignment you can use both side lining page.
  • Your writing should be neat and clean.

Index

Sr. No.

TitleDate

Sign.

1.

Introduction of C programs

2.

Programs with using if….else

3.

Programs with using switch case

4.

Programs with using while loop

5.

Programs with using for loop

6.

Programs with using arrays

7.

Programs with using string

8.

Programs with using pointers

9.

Programs with using functions

10.

Programs with using structures and union

11.

Programs with using file management

12.

Assignment

Practical set 1:-

  1. Write a program for printing your name and address.
  2. Write a program for addition, division, multiplication and subtraction of two numbers.
  3. Write a program to find sum and average of five numbers.
  4. Write a program to convert years into minute.
  5. What will be the output of following program segment?
i)                    int i=4, j=3, k;

float a,b;

k=i/j*j;

a=i/j*j;

b=j/i*i;

printf(“%d %d %f”,k,a,b);

ii)                  int b, a=5;

a++;

b= a++;

b++;

b=++a;

printf(“%d %d”,a,b);

  • Find out errors, if any in following code statements.

int a,b=0;

float x;

int float;

double p,q;

  • Write a program to print given decimal number into hexadecimal and octal number.
  • Write a program to convert the distance in feet and inches.

 

Practical set 2:-

  1. Write a program to find whether a number is even or odd.
  2. Write a program to swap two variables.
  3. Write a program to swap two variables without using third variable.
  4. Write a program to convert a given number of days into month and days.
  5. Write a program to convert temperature from Fahrenheit to Celsius.
  6. Write a program to find whether a number is positive or negative.
  7. Perform arithmetic operation according to given choice. (1= addition, 2= subtraction, 3= division, 4= multiplication, 5= modulo)
  8. Write a program to print sum of first n integer numbers using go to statement.

Practical set 3:-

  1. Write a program to enter the character and to find that the character is an alphabet or digit or any special symbol.
  2. Write a program to convert uppercase to lowercase and lowercase to uppercase.
  3. Write a program to find that given year is leap year or not.
  4. Write a program to find grade from a given marks.
  5. Write a program to find a larger value from three variables.
  6. Write a program to get a character from user and find that is it vowel or not.
  7. What will be the output of following?
i)                    if(x>0 && x<10)

printf(“single digit no.”);

else if(x>10 && x<100)

printf(“double digit no.”);

else

printf(“more then two digit no.”);

ii)                  if(choice= =1)

printf(“addition \n”);

else if(choice= =2)

printf(“subtraction \n”);

else if(choice= =3)

printf(“multiplication \n”);

else if(choice= =4)

printf(“division \n”);

else

printf(“wrong choice”);

 

Practical set 4:-

  1. Write a program to find a reverse number of given number.
  2. Write a program to find the sum of given number.
  3. Write a program to find the sum of even number from a given number.
  4. Write a program to find a factorial for a given number.
  5. Write a program to check that number is Armstrong or not.
  6. Write a program to check that given number is prime or not.
  7. Write a program to find a Fibonacci series.

 

Practical set 5:-

  • Write a program using for loop.
i)                    *

**

***

****

*****

ii)                  1

12

123

1234

12345

iii)                1

22

333

4444

55555

iv)                1

01

101

0101

10101

v)                  12345

1234

123

12

1

vi)

1

121

12321

1234321

123454321

vii)                      1

21

321

4321

54321

viii)            a b c d e

a b c d

a b c

a b

a

 

  • What will be the output of following code?
i)  for(i=0;i<10;i++)

{

if(i%2= =0)

j=i*i;

printf(“i=%d j=%d \n”,i,j);

}

 

Practical set 6:-

  1. Write a program to find average of five no. with arrays.
  2. Write a program to accept 5 no. in array and find maximum and minimum value of it.
  3. Write a program to accept 5 no. in array and find total no. of positive & negative no.
  4. Write a program to accept 5 no. in array and print in ascending order.
  5. Write a program to accept 10 no. in array and find the sum of all no.
  6. Write a program to find of odd and even numbers from given n numbers.

Practical set 7:-

  1. Write a program to find a length of a string.
  2. Write a program to that takes a string and reverse it and display both original and reverse string.
  3. Write a program to count how many times a particular character occurs in a given string. g. character ‘p’ occurs 2 times in string “apple”.
  4. Write a program to check whether the given string is palindrome or not. Palindrome strings are string which spells the same after reversal also. Following string are palindrome: madam, Malayalam, abba.
  5. Write a program that read two string and compare them using the function strcmp() and print the message that first string is equal, less, greater than second one.

Practical set 8:-

  1. Write a program to print address of a variable using pointer.
  2. Write a program that demonstrates the size of pointer.
  3. Write a program to find length of string using pointer.
  4. Write a program to print array elements in reverse using pointer.

Practical set 9:-

  1. Write a program to find a length of a string with using function.
  2. Write a program to reverse a given string with user defined function.
  3. Write a program to sum given two integer numbers using function.
  4. Write a program to find largest of three numbers using function.
  5. Write a program to check leap year using function.
  6. Write a program to exchange the value of two variables using function.

Practical set 10:-

  1. Write a program to create a structure of student’s roll no and name and display the records.
  2. Write a program to demonstrate initialization of structure members.
  3. Write a program to calculate average marks of N students for 3 different subjects using structures.
  4. Write a program to create a structure for car racing game and display start time, car number, game end time using nested structure.

Leave a Reply