## C program to Use structure within union & display the contents of structure elements

Problem Statement :Create one Structure and declare it inside union.Then accept values for structure members and display them. Write a program to use structure within union , display the contents of structure elements [crayon-628f6b3d5db40183568884/] Output : [crayon-628f6b3d5db50930570195/]

## C program to read the values of x, y and z and print the results expressions in one line.

Problem Statement : Write a program to read the values of x, y and z and print the results of the following expressions in one line. (x+y+z) / (x-y-z) (x+y+z) / 3 (x+y) * (x-y) * (y-z) [crayon-628f6b3d5f138898341524/] Output: [crayon-628f6b3d5f141681527252/]

## C Program to Sort set of strings in alphabetical order using strcmp()

Problem Statement : Write a C Program that will accept set of 5 strings and sort them using strcmp library function and print the result on the screen. Program to sort set of strings in alphabetical order [crayon-628f6b3d5f515683054640/] Output : [crayon-628f6b3d5f51d507493057/]

## C program to reads customer number and power consumed and prints amount to be paid

An electric power distribution company charges its domestic consumers as follows [crayon-628f6b3d5fb36433751409/] Write a C program that reads the customer number and power consumed and prints the amount to be paid by the customer. [crayon-628f6b3d5fb3d498495422/] Output : [crayon-628f6b3d5fb40435824043/]

## C Program to Read integers into an array and Reversing them using Pointers

Write a C program using pointers to read in an array of integers and print its elements in reverse order. [crayon-628f6b3d5ff16086651824/] Output : [crayon-628f6b3d5ff1d293368639/] Program to read integers into an array and reversing them using pointers Explanation : We have declared one pointer variable and one array. [crayon-628f6b3d5ff21233898972/] Address of first element of array is stored inside pointer variable. [crayon-628f6b3d5ff24052136116/] Accept Size of an Array. [crayon-628f6b3d5ff26766577868/] Now we have accepted element one by one using for loop and scanf statement . [crayon-628f6b3d5ff29670332885/] Increment pointer variable so that it will then point to [...]

## C Program to draw Inductive Coil using Graphical Function

C Program to Draw inductive Coil using Graphical Function [crayon-628f6b3d6038c560417432/]

## C Program to Draw Resistance using Graphics Function

C Program to Draw Resistance using Graphics Function [crayon-628f6b3d606f8234797827/]

## C Program to Draw PNP Transistor using Graphics Function

C Program to Draw PNP Transistor using Graphics Function [crayon-628f6b3d60a3b342153379/]

## C Program to Draw Eclipse using Graphics Function

C Program to Draw Eclipse in C using Graphics Function [crayon-628f6b3d60d79434213391/]

## C Program to Draw NPN Transistor using Graphics Function

C Program to Draw NPN Transistor using Graphics Function [crayon-628f6b3d610b7106684115/]

## C Program to Draw Capacitor using Graphics Function

C Program to Draw Capacitor using Graphics Function [crayon-628f6b3d613ed847652895/]

## C Program to Draw a Triangle using Graphics Function

Write a C Program to Draw A Triangle [crayon-628f6b3d6173a110884843/]

## C Program to Print Triangular Sequence Pyramid

C Program to Print Triangular Sequence Pyramid : [crayon-628f6b3d61d02278570045/] Explanation : [crayon-628f6b3d61d09255077692/] Outer for loop Indicates "How Many Lines is to be printed ?" Inner For Loop Tells "How many Numbers are printed on Single Line ?" Explain It ?? [crayon-628f6b3d61d0c472076902/]

## C Program to Calculate Size of Structure using Sizeof Operator

Program : Calculate Size of Structure in C Programming [crayon-628f6b3d620b1875684972/] Explanation : Structure is Collection of elements of the Different data Types. Size of the Structure Can be Evaluated using "sizeof Operator" [crayon-628f6b3d620b8243998580/] Formula for Calculating Size of Structure : [crayon-628f6b3d620bb164794115/] Remember : Sizeof is Operator not function Sizeof Operator Takes any Variable as Parameter.

## C Program to Copy Text From One File to Other File

Program : Copy Text From One File to Other File [crayon-628f6b3d6246f743726533/] Explanation :   To copy a text from one file to another we have to follow following Steps : Step 1 : Open Source File in Read Mode [crayon-628f6b3d62476373073621/] Step 2 : Open Target File in Write Mode [crayon-628f6b3d62479174208155/] Step 3 : Read Source File Character by Character [crayon-628f6b3d6247c429865019/] "fgetc" will read character from source file. Check whether character is "End Character of File" or not , if yes then Terminate Loop "putc" will write Single Character on File Pointed [...]

## C Program to Write on Data File and Read From Data File

Program : Write on the Data File [crayon-628f6b3d62ae3570911042/] Output : [crayon-628f6b3d62aea811869818/]

## Program to implement knapsack problem using greedy method

//Program to implement knapsack problem using greedy method What actually Problem Says ? Given a set of items, each with a weight and a value. Determine the number of each item to include in a collection so that the total weight is less than a given limit and the total value is as large as possible. It derives its name from the problem faced by someone who is constrained by a fixed-size knapsack and must fill it with the most useful items. Program : [crayon-628f6b3d630ef272820051/] Output [...]

## C Progran to Implement N Queen’s Problem using Backtracking

Program : C Progran to Implement N Queen's Problem using Backtracking [crayon-628f6b3d634b9514194561/] Output : [crayon-628f6b3d634c2633385542/]

## C Program to implement prims algorithm using greedy method

C Program to implement prims algorithm using greedy method [crayon-628f6b3d63887406373891/] Output : [crayon-628f6b3d63894277185293/]

## C Program to Add Two Numbers Using Pointer !

Program : How to Add Two Numbers Using Pointer ? In this program we are going to accept two numbers from user using pointer. After accepting two numbers we are going to add two numbers by using de-reference operator in Pointer. [crayon-628f6b3d63c4b888503495/] Output : [crayon-628f6b3d63c52500801685/] Note : Value Filed of Pointer Can Be Accessed Using '*' Operator '*' is value at Operator. Read '*ptr' as 'Value at Address ptr'.

## C Program to Implement Bubble Sort in C Programming

Bubble Sort in C : All Passes Program : [crayon-628f6b3d64265382751416/] What Happens After Each Iteration ? There are 'N' number of Unsorted Elements Total Number of Iterations = N-1 At the End of First Iteration : Largest Element Will get its Exact Final Position At the End of 2nd Iteration : 2nd Largest Element Will get its Exact Final Position . . . . At the End of (N-1)th Iteration : (N-1)th Largest Element Will get its Exact Final Position Output : [crayon-628f6b3d6426e743013341/] Visual Explanation :

## C Program to Reverse Letter in Each Word of the Entered String

Write a C Program to Reverse Letter in Each Word of the Entered String In this program we are going to accept a string . This program will check for word inside string and if word founds then program will reverse that word. Similarly it will reverse out all all the words. [crayon-628f6b3d64872732890485/] Output : [crayon-628f6b3d6487b919698380/] Explanation of C Program : Step 1 : Space Character Encountered [crayon-628f6b3d6487e881401132/] Store Character into Another String Variable. As soon as Space character encounters then reverse the string and print the [...]

## C Program to Print Fibonacci Series using recursion !!

Back to Basics : Fibonacci Series In the 12th century, Leonardo Fibonacci discovered a simple numerical series Called Fibonacci Series. Starting with 0 and 1, each new number in the series is simply the sum of the two before it. To watch more about Fibonacci series - Click on this Video. It will Explain everything about this series. C Program to print Fibonacci Series using recursion !! [crayon-628f6b3d64e8e312187640/] Output : [crayon-628f6b3d64e96547997192/]

## C Program to Sort Structures on the basis of Structure Element

Sorting Two Structures on the basis of any structure element and Display Information Program Statement - Define a structure called cricket that will describe the following information Player name Team name Batting average Using cricket, declare an array player with 10 elements and write a program to read the information about all the 10 players and print a team wise list containing names of players with their batting average. [crayon-628f6b3d6523d087314948/] Output : [crayon-628f6b3d65245560824754/] Explanation of C Program : Step 1 : Accept Data [crayon-628f6b3d65249363585503/] Step 2 : Sorting two Structures [crayon-628f6b3d6524c309277223/] Using [...]

## C Program to Print Mirror of Right Angled Triangle

Pyramid Program in C Programming - Mirror Image of Right Angled Triangle Print the Following Pattern of Pyramid [crayon-628f6b3d65912040626489/] Program : [crayon-628f6b3d65919669513542/] Explanation of C Program : 'space_count' variable is used as subscript variable used in for loop. 'no_of_spaces' variable is used to keep track of no_of_spaces to be printed. Note that Space width mentioned in printf of second inner loop is "%2c" , that's why we have printed 2 spaces inside first inner loop. Why 3 for loops are used  ? Outer For Loop - Specify No of Rows to be Printed First [...]