C Programming Laboratory Programs and Concepts

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/18

flashcard set

Earn XP

Description and Tags

Vocabulary flashcards covering core C programming algorithms, mathematical formulations, array manipulation, string routines, and pointer operations.

19 Terms

1
New cards

Simple Interest Formula

The mathematical formula implemented to calculate simple interest on a principal amount: simple_interest=principal×rate×time100\text{simple\_interest} = \frac{\text{principal} \times \text{rate} \times \text{time}}{100}.

2
New cards

Compound Interest Formula

The formula used to compute compound interest: compound_interest=principal×pow(1+rate100, time)−principal\text{compound\_interest} = \text{principal} \times \text{pow}\left(1 + \frac{\text{rate}}{100},\, \text{time}\right) - \text{principal}.

3
New cards

Two-Variable Swapping Algorithm

An arithmetic logic that exchanges the values of two integer variables without utilizing a temporary third variable: a=a+ba = a + b, b=a−bb = a - b, and a=a−ba = a - b.

4
New cards

Quadratic Discriminant

The algebraic expression discriminant=b×b−4×a×c\text{discriminant} = b \times b - 4 \times a \times c used to determine root characteristics: distinct real roots if discriminant>0\text{discriminant} > 0, equal real roots if discriminant=0\text{discriminant} = 0, and complex roots if discriminant<0\text{discriminant} < 0.

5
New cards

Complex Roots Formulas

The mathematical calculations used when the quadratic discriminant is negative: the real part is realPart=−b2×a\text{realPart} = \frac{-b}{2 \times a} and the imaginary part is imagPart=−discriminant2×a\text{imagPart} = \frac{\sqrt{-\text{discriminant}}}{2 \times a}.

6
New cards

Multiplication Table Logic

An iterative construct that outputs the multiples of a given integer by executing a loop from i=1i = 1 to i=10i = 10 and calculating num×i\text{num} \times i.

7
New cards

Prime Number Check Logic

An algorithm that identifies non-prime numbers by setting flag=1\text{flag} = 1 if num=0\text{num} = 0 or num=1\text{num} = 1, or if num(modi)=0\text{num} \pmod i = 0 for any divisor ii ranging from 22 up to num2\frac{\text{num}}{2}.

8
New cards

Integer Palindrome Algorithm

A procedure that checks if a number reads the same forwards and backwards by extracting digits using rem=n(mod10)\text{rem} = n \pmod{10}, accumulating rev=rev×10+rem\text{rev} = \text{rev} \times 10 + \text{rem}, updating n=n10n = \frac{n}{10}, and checking if n1=revn_1 = \text{rev}.

9
New cards

Decimal to Binary Conversion (0–255)

A technique to convert a positive integer up to 255255 into binary by iteratively recording remainders bit[i]=number(mod2)\text{bit}[i] = \text{number} \pmod 2, dividing number=number2\text{number} = \frac{\text{number}}{2}, and printing the stored bits in reverse order.

10
New cards

Array Sum Accumulation

An algorithm that calculates the total sum of array elements by initializing an accumulator to sum=0\text{sum} = 0 and iteratively updating sum=sum+array[i]\text{sum} = \text{sum} + \text{array}[i] across all indices.

11
New cards

Largest Element Algorithm

A linear search logic that initializes largest=a[0]\text{largest} = a[0], compares each subsequent array element, and reassigns largest=a[i]\text{largest} = a[i] whenever largest<a[i]\text{largest} < a[i].

12
New cards

Matrix Multiplication Compatibility Condition

The requirement that matrix multiplication is valid only when the number of columns in the first matrix equals the number of rows in the second matrix (c1=r2c_1 = r_2).

13
New cards

Matrix Multiplication Algorithm

The triple-nested loop computation where each element of the resulting matrix is computed as C[i][j]=0C[i][j] = 0 and accumulated via C[i][j]+=A[i][k]×B[k][j]C[i][j] += A[i][k] \times B[k][j] for index kk from 00 to c1−1c_1 - 1.

14
New cards

Substring Insertion Algorithm

A string operation that shifts characters starting at target index nn forward by l2l_2 positions via str1[i+l2]=str1[i]str_1[i + l_2] = str_1[i] and copies the characters of the second string str2str_2 directly into index positions starting at nn.

15
New cards

Character Deletion Algorithm

A string manipulation technique that removes nn characters starting at position pos\text{pos} by shifting subsequent characters left using str[i−n]=str[i]str[i - n] = str[i] and null-terminating the string at index l−nl - n.

16
New cards

String Palindrome Check

A comparison procedure that verifies whether a string matches its reverse by testing if string1[i]=string1[length−i−1]string_1[i] = string_1[\text{length} - i - 1] for every index ii from 00 up to length2−1\frac{\text{length}}{2} - 1.

17
New cards

malloc Function

A dynamic memory allocation function declared in used to allocate heap memory of a specified byte size, instantiated as (int *) malloc(n * sizeof(int)).

18
New cards

Pointer Offset Dereferencing

A pointer access method that reads and accumulates values from dynamically allocated memory using the dereferencing syntax *(a + i) for each index offset ii.

19
New cards

Reverse Array Pointer Traversal

A traversal method where a pointer is initialized to the last array element address (&arr[n - 1]) and systematically moved backward using the decrement operator (ptr--) to print elements in reverse order.