C Lab programs Archive
Approach-1: In this approach we simply used printf() function from stdio.h header file. We specified ‘#’ character in printf() function based on output pattern. Approach-2: In C programming, we can process and display the information …
Perimeter of rectangle: Perimeter of rectangle is given by the below formula is, Perimeter = 2 * (height + width) Approach-1: In this approach, we define the complete logic in main() function. We read the …
This program is simple to understand how to declare(or define) variables. We use all types of variables and display the values using corresponding format specifiers.
Note: x1, y1, x2, y2 are all double values. Approach-1: In this approach, we read values of x1, x2, x3, x4 and calculated the distance between those points. Remember the points must be of double …
Solution: The number of rows and columns in A is equal to number of columns and rows in B respectively. Thus, the matrix B is known as the Transpose of the matrix A. The transpose of matrix …
remove(): It used to rename the specified file. Prototype is: int remove(char* target); On success, it returns 0 On failure, it returns -1
Approach-1: We use strtol() function to covert string to long integer. It is belongs to stdlib.h header file. The prototype of function is long int strtol(const char *str, char **endptr, int base) It converts the …
Approach-1: Simple menu driven programs are very helpful to students in application development. In this code, we created a simple menu used to perform all computational operations on geometrical shapes In this approach, we execute …
Factorial Program in C: Factorial of n is the product of all positive descending integers. Factorial of n is denoted by n!. For example: 5! = 5*4*3*2*1 = 120 3! = 3*2*1 = 6 Approach-1: …