C Articles

Page 69 of 96

Program to calculate the Area and Perimeter of Incircle of an Equilateral Triangle\\nWhat is Equilateral Triangle in C?

Sunidhi Bansal
Sunidhi Bansal
Updated on 20-Sep-2019 258 Views

What is Equilateral Triangle?As the name suggests, equilateral triangle is the one that have equal sides and also it have equal interior angles of 60° each. It is also known as regular triangle because it’s a regular polygonProperties of equilateral triangle are −3 sides of equal lengthInterior angles of same degree which is 60IncircleIncircle is the circle that lies inside the triangle which means the center of circle is same as of triangle as shown in the figure below. The center of incircle is known as incenter and radius is known as inradius.Given below is the figure of Incircle of ...

Read More

Program for EMI Calculator in C program

Sunidhi Bansal
Sunidhi Bansal
Updated on 20-Sep-2019 947 Views

Given with certain values the program will develop an EMI calculator to generate the needed output. EMI stands for Equated Monthly Installment. So this calculator will generate monthly EMI amount for the user.ExampleInput-: principal = 2000    rate = 5    time = 4 Output-: Monthly EMI is= 46.058037The formula used in the below program is −EMI : (P*R*(1+R)T)/(((1+R)T)-1)where, P indicates loan amount or the Principal amount.R indicates interest rate per monthT indicates loan time period in yearApproach used below is as followsInput principal, rate of interest and time in float variableApply the formula to calculate the EMI amountPrint the ...

Read More

C Program to find IP Address, Subnet Mask & Default Gateway

sudhir sharma
sudhir sharma
Updated on 19-Sep-2019 1K+ Views

C programming language can be used to find the details of the Internet connection of the system. Now, let’s learn about the basics terms that we need in this problem.IP Address − IP Address stands for Internet Protocol address. An IP address is a fixed numerical identification number that is associated with each device. IP address allows communication of your device using IP address over the internet.Subnet Mask − A 32-bit component of the IP address. The subnet mask differentiates the network component of IP address into two parts of the IP address. One being network address and other being ...

Read More

C program to compare two files and report mismatches

sudhir sharma
sudhir sharma
Updated on 19-Sep-2019 9K+ Views

In the C programming language, the programmer can excess the files and read and write content in them.A file is a simple memory block that can store information, here we are concerned with text only.In this program, we will compare two files and report mismatches that occur. These files are almost identical but may have some characters that are different. Also, the program will return the line and position of the file at which the first mismatch occurs.AlgorithmStep 1: Open both the file with pointer at the starting. Step 2: Fetch data from file as characters one by one. Step ...

Read More

Difference between Compile Time Errors and Runtime Errors in C Program

Nitin Sharma
Nitin Sharma
Updated on 18-Sep-2019 2K+ Views

Error or exception is something that refers to the interruption of code execution due to which the expected outcome could not be attained to the end-user.On the basis of the event when an error is generated or identified we can classify them as Compile time error and runtime error.The following are the important differences between Compile Time Errors and Runtime Errors.Sr. No.KeyCompile Time ErrorsRuntime Errors1ReferenceCompile-time errors are generally referred to the error corresponding to syntax or semantics.Runtime errors on the other hand refer to the error encountered during the execution of code at runtime.2DetectionCompile-time errors get detected by compiler at ...

Read More

Print symmetric double triangle pattern in C language

Sunidhi Bansal
Sunidhi Bansal
Updated on 22-Aug-2019 455 Views

Given with number of lines the program must print the symmetric double triangle pattern with least complexity.ExampleInput: 5 Output:  X           X           O X            O X     X O X O X        X O         X O          X           XThe entire problem contains 3 different partitions −Print upper half with n-1 lines for odd n or n-2 lines for even n.Print middle lines, 1 line for odd n or ...

Read More

Print shortest path to print a string on screen in C Program.

Sunidhi Bansal
Sunidhi Bansal
Updated on 22-Aug-2019 351 Views

Given a string, the program must display the shortest path which will print the string over the screen using that shortest path.Like screen will store alphabets in the formatA B C D E F G H I J K L M N O P Q R S T U V W X Y ZExampleInput: HUP Output : Move Down Move Down Move Down destination reached Move Left Move Left Move Down Move Down Move Down destination reached Move Up destination reachedThe approach used here is to store the characters in the n x n matrix and perform the following operation ...

Read More

Print numbers with digits 0 and 1 only such that their sum is N in C Program.

Sunidhi Bansal
Sunidhi Bansal
Updated on 22-Aug-2019 404 Views

Given an integer n, the task is to print the numbers who consist only 0’s and 1’s and their sum is equal to the integer n.The numbers which contain only zeros and ones are 1, 10, 11 so we have to print all those numbers which can be added to form the sum equal to n.Like, we entered n = 31 then the answer can be 10+10+11 or 10+10+10+1 theExampleInput: 31 Output:10 10 10 1Algorithmint findNumbers(int n) START STEP 1: DECLARE AND ASSIGN VARAIBALES m = n % 10, a = n STEP 2: LOOP WHILE a>0    IF a/10 ...

Read More

Print sorted distinct elements of array in C language

Sunidhi Bansal
Sunidhi Bansal
Updated on 22-Aug-2019 614 Views

Given with an array of integer elements, the task is to remove the duplicate values and print the distinct elements in sorted manner.Given below is an array that stores integer type values in the fashion 4, 6, 5, 3, 4, 5, 2, 8, 7 and 0 now, the result will print the sorted elements as 0, 2, 3, 4, 4, 5, 5, 6, 7 and 8 but this result still contains duplicate values 4 and 5 which should be removed and the final result will be 0, 2, 3, 4, 5, 6, 7 and 8ExampleInput: array[] = {4, 6, 5, ...

Read More

Print nodes of linked list at given indexes in C language

Sunidhi Bansal
Sunidhi Bansal
Updated on 22-Aug-2019 6K+ Views

We have to print the data of nodes of the linked list at the given index. Unlike array linked list generally don’t have index so we have to traverse the whole linked list and print the data when we reached a particular.Let’s say, list contains the nodes 29, 34, 43, 56 and 88 and the value of indexes are 1, 2 and 4 than the output will be the nodes at these indexes that are 34, 43 and 88.ExampleLinked list: 29->34->43->56->88 Input: 1 2 4 Output: 34 43 88In above representation of Linked List the yellow highlighted nodes are the ...

Read More
Showing 681–690 of 953 articles
« Prev 1 67 68 69 70 71 96 Next »
Advertisements