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-61758a403960d636775157/] Output : [crayon-61758a4039618182740408/]
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-61758a403a346156575446/] Output: [crayon-61758a403a34e124426406/]
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-61758a403a690773450847/] Output : [crayon-61758a403a698711257352/]
An electric power distribution company charges its domestic consumers as follows [crayon-61758a403a9f8902979057/] Write a C program that reads the customer number and power consumed and prints the amount to be paid by the customer. [crayon-61758a403a9ff710844925/] Output : [crayon-61758a403aa02867896446/]
Write a C program using pointers to read in an array of integers and print its elements in reverse order. [crayon-61758a403ad9a489935031/] Output : [crayon-61758a403ada1362686732/] Program to read integers into an array and reversing them using pointers Explanation : We have declared one pointer variable and one array. [crayon-61758a403ada5489191186/] Address of first element of array is stored inside pointer variable. [crayon-61758a403ada7034972068/] Accept Size of an Array. [crayon-61758a403adaa582409844/] Now we have accepted element one by one using for loop and scanf statement . [crayon-61758a403adad049070707/] Increment pointer variable so that it will then point to [...]
C Program to Print Triangular Sequence Pyramid : [crayon-61758a403c6df359901059/] Explanation : [crayon-61758a403c6e6703965992/] 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-61758a403c6e9829483610/]
Program : Calculate Size of Structure in C Programming [crayon-61758a403ca7d632284671/] Explanation : Structure is Collection of elements of the Different data Types. Size of the Structure Can be Evaluated using "sizeof Operator" [crayon-61758a403ca84542587286/] Formula for Calculating Size of Structure : [crayon-61758a403ca87536195861/] Remember : Sizeof is Operator not function Sizeof Operator Takes any Variable as Parameter.
Program : Copy Text From One File to Other File [crayon-61758a403ce25061451569/] 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-61758a403ce2c307641428/] Step 2 : Open Target File in Write Mode [crayon-61758a403ce2f277293720/] Step 3 : Read Source File Character by Character [crayon-61758a403ce32012643036/] "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 [...]
//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-61758a403d55d582937825/] Output [...]
Program : C Progran to Implement N Queen's Problem using Backtracking [crayon-61758a403d8de481277011/] Output : [crayon-61758a403d8e6674297094/]
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-61758a403e02d106099537/] Output : [crayon-61758a403e034922184528/] Note : Value Filed of Pointer Can Be Accessed Using '*' Operator '*' is value at Operator. Read '*ptr' as 'Value at Address ptr'.
Bubble Sort in C : All Passes Program : [crayon-61758a403e39e876202055/] 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-61758a403e3a6242724049/] Visual Explanation :
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-61758a403e958782328455/] Output : [crayon-61758a403e960957489474/] Explanation of C Program : Step 1 : Space Character Encountered [crayon-61758a403e963358836961/] Store Character into Another String Variable. As soon as Space character encounters then reverse the string and print the [...]
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-61758a403ecc7914058975/] Output : [crayon-61758a403ecce500820276/]
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-61758a403f04b914879665/] Output : [crayon-61758a403f053657234705/] Explanation of C Program : Step 1 : Accept Data [crayon-61758a403f057536009258/] Step 2 : Sorting two Structures [crayon-61758a403f05a445697848/] Using [...]
Pyramid Program in C Programming - Mirror Image of Right Angled Triangle Print the Following Pattern of Pyramid [crayon-61758a403f631941393760/] Program : [crayon-61758a403f637063724658/] 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 [...]