Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Articles by Mandalika
409 articles
How to delete all the DB2 packages in collection COLL1?
A DB2 collection is a physical quantity which is used to group the packages. A collection can be simply termed as a group of DB2 packages. By using collections we can bind the same DBRM into different packages. In order to delete all the DB2 packages under a collection, we can issue the FREE PACKAGE command. Syntax FREE PACKAGE(collection_name.*) Example: Deleting All Packages in COLL1 To delete all packages in the collection named COLL1, use the following command: // DB2 command to delete all packages in COLL1 collection console.log("Executing: FREE PACKAGE(COLL1.*)"); ...
Read MoreWrite a C program to maintain cricketer's information in tabular form using structures
In C programming, we can use structures to organize and store cricketer information such as name, age, number of matches, and average runs. This program demonstrates how to input multiple cricketer records and display them in a sorted tabular format based on their average runs. Syntax struct structure_name { data_type member1; data_type member2; // ... more members }; Approach We will create a structure to hold cricketer information, input data for multiple cricketers, sort them based on average runs using bubble sort, ...
Read MoreWrite a C program to calculate the average word length of a sentence using while loop
In C programming, calculating the average word length of a sentence involves counting the total characters (excluding spaces) and dividing by the number of words. This program demonstrates how to use a while loop to process user input character by character and calculate the average word length. Syntax while(condition) { // Process each character // Count characters and words } Algorithm Read the sentence character by character using a while loop Count total characters (excluding spaces) and words Calculate average by dividing character count by ...
Read MoreWrite a C program to print numbers in words using elseif statements
In C programming, we can convert numbers into their word equivalents using else-if statements instead of switch cases. This approach is particularly useful for handling two-digit numbers by breaking them into tens and units places. Syntax if (condition1) { // statements } else if (condition2) { // statements } else if (condition3) { // statements } else { // default statements } Algorithm The program uses multiple else-if conditions to handle different number ranges − Range ...
Read MoreWrite a C program to print the message in reverse order using for loop in strings
Here we write a program to reverse the sentence without predefined functions. By using for loop, we can easily print statement in reverse order. Syntax for(initialization; condition; increment/decrement) { // Read characters } for(reverse_initialization; reverse_condition; reverse_increment) { // Print characters in reverse } Method 1: Character-by-Character Input Using getchar() This approach reads each character individually using getchar() and stores them in an array. Then it prints the characters in reverse order − #include int main() { char stmt[100]; ...
Read MoreHow to print a one-month calendar of user choice using for loop in C?
A one-month calendar can be printed in C using for loops by positioning the first day correctly and then printing all days in a week-by-week format. The key is to add proper spacing before the first day and break lines after every 7 days. Syntax for(i = 1; i < firstDay; i++) printf(" "); // Add spaces before first day for(i = 1; i
Read MoreGenerate an even squares between 1 to n using for loop in C Programming
Even square numbers are the squares of even integers like 22, 42, 62, 82, which result in 4, 16, 36, 64, 100, and so on. In this tutorial, we will generate even squares between 1 to n using a for loop in C programming. Syntax for (initialization; condition; increment) { // Loop body } Algorithm START Step 1: Declare variables a and n Step 2: Read number n from user Step 3: Use for loop to generate even squares For a = 2; a*a
Read MoreSwapping numbers using bitwise operator in C
Swapping two numbers using bitwise operators in C is an efficient technique that uses the XOR (^) operator to exchange values without requiring additional memory for a temporary variable. This method works by exploiting the property that XORing a number with itself results in zero. Syntax a = a ^ b; b = a ^ b; a = a ^ b; How XOR Swapping Works The XOR swap algorithm works on the mathematical property that X ^ X = 0 and X ^ 0 = X. When we perform the three XOR operations, the ...
Read MoreWrite a C program to reduce any fraction to least terms using while loop
Reducing a fraction to its lowest terms means finding the simplest form where the numerator and denominator have no common factors other than 1. This is achieved by dividing both numbers by their Greatest Common Divisor (GCD). Syntax while (condition) { // Find GCD and reduce fraction } Method 1: Using Euclidean Algorithm This method uses the Euclidean algorithm to find the GCD efficiently − #include int main() { int numerator, denominator, original_num, original_den; int temp, gcd; ...
Read MoreConverting digits to word format using switch case in C language
Converting digits to word format is a common programming problem that helps understand switch-case statements and number manipulation. In C, we can convert one or two-digit numbers into their English word equivalents using switch statements. Syntax switch(expression) { case value1: // code block break; case value2: // code block break; default: ...
Read More