C Practice Programs- 2

  1. Write a function to find the middle element of a given singly linked list in C.

Input:               Head of linked list

Output:            Middle value of the list

For example, if the given linked list is 1->2->3->4->5 then, output should be 3.

If there are even number of elements, then there would be two middle elements, then output should be the second middle element.

For example, if given linked list is 1->2->3->4->5->6 then, output should be 4.


  1. Program to split string by single space into words ?

Input: Welcome to C Programming

Output:

Welcome

to

C

Programming

No. of words: 4


  1. Given two numbers, find the sum of prime numbers between them, both inclusive.

Input    : 1 5

Output : 10


  1. Write a program to find the second largest number in the integer array, A, of size N.

Range: 0≤A≤100  0≤N≤100

Input    : 8 11 22 6 8 9 18 19 10  //here first 8 indicates size of array.

Output : 19



You can find the solution programs here C Programming 2

If you have any queries fell free to ask them here.

C Practice Programs

So guys, here are some basic C programs that you must know!!

  1. Area of circle using pointer.
    input: 3.5
    output: 38.465


  2. C program to Accessing Value from Address using Pointer
    input: 5
    output: 5


  3. Number Pyramid Pattern in C Programming
    input: 5
    output:
    1
    1 1
    1 2 1
    1 3 3 1
    1 4 6 4 1


  4. Generate the Fibonacci Series starting from any two numbers?
    input:  10 20 200        //here 200 is the limit
    output:  10 20 30 50 80 130


  5. Reverse a given number !
    input: 123
    output: 321


  6. Check Whether Number is Perfect Or Not
    input: 6
    output: perfect number

 

Do try them, and yes, you can always find the solution here

Design a site like this with WordPress.com
Get started