0% found this document useful (0 votes)
347 views

C Programming

The document contains 18 code snippets with the aim, procedure and coding for various C programming problems. These include programs to take student details and calculate percentage, find maximum of two numbers, check if a character is vowel or consonant, print integers from 1 to 10, check if a number is palindrome, generate Fibonacci series, manipulate arrays, concatenate and compare strings, recursion, functions, pointers, structures and unions.

Uploaded by

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

C Programming

The document contains 18 code snippets with the aim, procedure and coding for various C programming problems. These include programs to take student details and calculate percentage, find maximum of two numbers, check if a character is vowel or consonant, print integers from 1 to 10, check if a number is palindrome, generate Fibonacci series, manipulate arrays, concatenate and compare strings, recursion, functions, pointers, structures and unions.

Uploaded by

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

1.

write a c program to take input of name, rollno and marks obtained by a student in 4 subjects of 100
marks each and display the name, rollno with percentage score secured.

AIM:
Create a c program to take input of name ,rollno and marks obtained by a student in 4 subjects of 100
marks each and display the name,rollno with percentage score secured

PROCEDURE:
STEP 1: Start the program
STEP 2: Declare the variables
STEP 3: Get the input from the user like name ,rollno and four subjects marks
STEP 4: Calculate the values of total and percentage
STEP 5: Display the program
STEP 6: Stop the program
SOURCE CODING:
OUTPUT:

RESULT:
Thus the following output was successfully executed.

2. write a c program to input two number and display the maximum number.

AIM:
Create a c program to input two number and display the maximum number.

PROCEDURE:
STEP 1: Start the program
STEP 2: Declare the variables
STEP 3: Get the input of the two numbers
STEP 4: Check whether a two inputs are different
STEP 5: Display the program
STEP 6: Stop the program

SOURCE CODING:

OUTPUT:
RESULT:
Thus the following output was successfully executed.

3.write a c program to find whether a character is consonant or vowel using switch statement.

AIM:
Create a c program to find whether a character is consonant or vowel using switch statement.

PROCEDURE:
STEP 1: Start the program
STEP 2: Declare the variables
STEP 3: Get the input of the character
STEP 4: Check whether a character is consonant or vowel
STEP 5: Display the program
STEP 6: Stop the program

SOURCE CODING:
OUTPUT:
RESULT:
Thus the following output was successfully executed.

4.write a c program to print positive integers from 1 to 10.

AIM:
Create a c program to print positive integers from 1 to 10.

PROCEDURE:
STEP 1: Start the program
STEP 2: Declare the variables
STEP 3: Check the for loop (i=1;i<10;i++) for print the positive integers from 1 to 10
STEP 4: Display the program
STEP 5: Stop the program

SOURCE CODING:
OUTPUT:
RESULT:
Thus the following output was successfully executed

5.write a c program to check whether a number is palindrome or not.

AIM:
Create a c program to check whether a number is palindrome or not.

PROCEDURE:
STEP 1: Start the program
STEP 2: Declare the variables
STEP 3: Check whether a number is palindrome or not
STEP 4: Display the program
STEP 5: Stop the program
SOURCE CODING:

OUTPUT:
RESULT:
Thus the following output was successfully executed

6.write a c program to generate Fibonacci series.

AIM:
Create a c program to generate Fibonacci series.

PROCEDURE:
STEP 1: Start the program
STEP 2: Declare the variables
STEP 3: Get the input of number of terms
STEP 4: Check whether a series is correct
STEP 5: Display the program
STEP 6: Stop the program

SOURCE CODING:

OUTPUT:
RESULT:
Thus the following output was successfully executed

7.write a c program to insert 5 elements into an array and print the elements of the array.

AIM:
Create a c program to insert 5 elements into an array and print the elements of the array.

PROCEDURE:
STEP 1: Start the program
STEP 2: Declare the variables
STEP 3: Get the input of 5 elements into an array and print the elements of the array
STEP 4: Check whether a array was printed which user given.
STEP 5: Display the program
STEP 6: Stop the program

SOURCE CODING:

OUTPUT:
RESULT:
Thus the following output was successfully executed

8.write a c program to reverse the array elements in c programming.


AIM:
Create a c program to reverse the array elements in c programming.

PROCEDURE:
STEP 1: Start the program
STEP 2: Declare the variables
STEP 3: Get the input of 5 elements into an array and print the elements of the array
STEP 4: Check whether a array was printed was reverse which user given.
STEP 5: Display the program
STEP 6: Stop the program

SOURCE CODING:

OUTPUT:
RESULT:
Thus the following output was successfully executed

9.write a c program to concatenate two strings.


AIM:
Create a c program to concatenate two strings.

PROCEDURE:
STEP 1: Start the program
STEP 2: Declare the variables
STEP 3: Get the input of 5 elements into an array and print the elements of the array
STEP 4: Check whether a array was printed which user given.
STEP 5: Display the program
STEP 6: Stop the program

SOURCE CODING:

OUTPUT:
RESULT:
Thus the following output was successfully executed
10.write a c program to compare two strings without using string library functions.

AIM:
Create a c program to compare two strings without using string library functions.

PROCEDURE:
STEP 1: Start the program
STEP 2: Declare the variables
STEP 3: Get the input of two string from the user
STEP 4: Check whether a two strings without using string library functions
STEP 5: Display the program
STEP 6: Stop the program

SOURCE CODING:
OUTPUT:
RESULT:
Thus the following output was successfully executed

11.write a c program to generate Fibonacci series using recursive function

AIM:
Create a c program to generate Fibonacci series using recursive function.

PROCEDURE:
STEP 1: Start the program
STEP 2: Declare the variables
STEP 3: Get the input from the user
STEP 4: Check whether a series are correct or wrong.
STEP 5: Display the program
STEP 6: Stop the program

SOURCE CODING:

OUTPUT:
RESULT:
Thus the following output was successfully executed

12.write a c program to find power of any number using recursion

AIM:
Create a c program to find power of any number using recursion.

PROCEDURE:

STEP 1: Start the program


STEP 2: Declare the variables
STEP 3: Get the input of X and Y from the user
STEP 4: Check whether to find power of any number using recursion
STEP 5: Display the program
STEP 6: Stop the program

SOURCE CODING:
OUTPUT:
RESULT:
Thus the following output was successfully executed

13.write a c program to add, subtract, multiply and divide two integers using user defined type function with
return type.

AIM:
Create a c program to add, subtract, multiply and divide two integers using user defined type function
with return type.

PROCEDURE:

STEP 1: Start the program


STEP 2: Declare the variables
STEP 3: Get the input of two integers from the user
STEP 4: Check whether two integers user defined function of add, subtract, multiply and divide
operation
STEP 5: Display the program
STEP 6: Stop the program

SOURCE CODING:
OUTPUT:
RESULT:
Thus the following output was successfully executed

14.write a c program to swap two integer using call by value and call by Reference methods of passing
Arguments to a function

AIM:
Create a c program to swap two integer using call by value and call by Reference methods of passing
Arguments to a function

PROCEDURE:

STEP 1: Start the program


STEP 2: Declare the variables
STEP 3: Get the input of two integers A &B from the user
STEP 4: Check whether swap two integer using call by value and call by Reference methods of passing
Arguments to a function
STEP 5: Display the program
STEP 6: Stop the program

SOURCE CODING:
OUTPUT:

RESULT:
Thus the following output was successfully executed
15.write a c program to find biggest among three numbers using pointer.

AIM:
Create a c program to find biggest among three numbers using pointer.

PROCEDURE:

STEP 1: Start the program


STEP 2: Declare the variables
STEP 3: Get the input of three integer from the user
STEP 4: Check whether is biggest among three numbers using pointer
STEP 5: Display the program
STEP 6: Stop the program

SOURCE CODING:
OUTPUT:

RESULT:
Thus the following output was successfully executed
16.write a c program to compare two strings using pointers.

AIM:
Create a c program to compare two strings using pointers

PROCEDURE:

STEP 1: Start the program


STEP 2: Declare the variables
STEP 3: Get the input of two strings from the user
STEP 4: Check whether is the two strings is equal or unequal.
STEP 5: Display the program
STEP 6: Stop the program

SOURCE CODING:
OUTPUT:
RESULT:
Thus the following output was successfully executed

17.write a c program to create, declare and initialize structure.

AIM:
Create a c program to create, declare and initialize structure.

PROCEDURE:

STEP 1: Start the program


STEP 2: Declare the variables
STEP 3: Get the input such as roll no name department marks
STEP 4: Check whether is the two strings is equal or unequal.
STEP 5: Display the program
STEP 6: Stop the program

SOURCE CODING:
OUTPUT:
RESULT:
Thus the following output was successfully executed

18.write a c program to declare, initialize an UNION.

AIM
Create a c program to declare, initialize an UNION.

PROCEDURE:

STEP 1: Start the program


STEP 2: Declare the variables
STEP 3: Check whether is the union values are assign the values such as int x; float y; char z.
STEP 4: Display the program
STEP 5: Stop the program

SOURCE CODING:
OUTPUT:
RESULT:
Thus the following output was successfully executed

19.write a c program to create a file called emp.rec and store information about a person ,in terms of his name,
age and salary.

AIM:
Create a c program to create a file called emp.rec and store information about a person ,in terms of his
name, age and salary

PROCEDURE:

STEP 1: Start the program


STEP 2: Declare the variables
STEP 3: Get the input such as name, age, salary
STEP 4: Check whether is the file is created
STEP 5: Display the program
STEP 6: Stop the program
SOURCE CODING:
OUTPUT:
Open the file with notepad.

RESULT:
Thus the following output was successfully executed

20.write a c program to list all files and sub-directories in a directory.


AIM:

Create a c program to list all files and sub-directories in a directory.

PROCEDURE:

STEP 1: Start the program


STEP 2: Declare the variables
STEP 4: Check whether is the opendir() is function open or not
STEP 5: Display the program
STEP 6: Stop the program

SOURCE CODING:
OUTPUT:

RESULT:

Thus the following output was successfully executed.

You might also like