 # C Programming Code Examples

## C > Beginners Lab Assignments Code Examples

### Program to find the type of the triangle made by i-p values

C++ Checks if an Undirected Graph is Tree - C++ Program to check whether an undirected 'graph is tree' or not. Graph is tree if it doesn't contain cycles. A recursive function that uses visited[] & parent to detect cycle in subgraph

Writing String to a File in C Programming - Str - str represents the array, in which string is stored. Fpw - FILE pointer to the output file, in which record needs to be written and opening the file FILEW.TXT in "w" mode for

Checks if an Directed Graph is Tree or Not - A C++ Program to check whether an directed graph is tree or not. Graph is tree if it doesn't contain cycles. Pointer to an array containing adjacency lists. Returns true if there is a cycle

C Program Code Find Length of the String - "Gets()" is used to accept string with Spaces and we are "Passing accepted String" to the function. Inside function we have stored this string in pointer. Inside "While Loop" we are

C Program to Display Factors of a Number - This C Program takes a Positive Integer from the user & displays all the positive factors of that number. The for loop is iterated until j<= Number is False. In each iteration, number is

Code Converts Binary Number to Decimal - Program code input binary number from user & convert binary number to decimal number system. The Binary Number system is a base 2 number system and uses only 2 symbols to

C++ Coding Generating Random Numbers - Following C++ program generate 100 random numbers using rand() function of stdlib.h. To generate random numbers in C++, we use the function rand() to generate and print random

C++ Implement Shortest Path Algorithm - For a general weighted graph, we calculate single source shortest distances in "O(VE)" time using 'Bellman-Ford Algorithm'. For a graph with no negative weights, we can do