sudhir sharma

sudhir sharma

975 Articles Published

Articles by sudhir sharma

Page 13 of 98

bar() function in C graphics

sudhir sharma
sudhir sharma
Updated on 15-Mar-2026 2K+ Views

The bar() function in C graphics is used to draw a filled rectangular bar. It is defined in the graphics.h header file and is commonly used for creating bar charts and filled rectangular shapes in graphics programming. Syntax void bar(int left, int top, int right, int bottom); Parameters left − X-coordinate of the top-left corner top − Y-coordinate of the top-left corner right − X-coordinate of the bottom-right corner bottom − Y-coordinate of the bottom-right corner How It Works ...

Read More

Bands in Radio frequency Spectrum in C program

sudhir sharma
sudhir sharma
Updated on 15-Mar-2026 694 Views

Radio frequency (RF) is the oscillation of an A.C. current or voltage in the frequency range of 20KHz to 300 GHz. In C programming, we can create programs to classify and work with different RF bands. Radio frequency spectrum is divided into bands − frequency ranges used for specific applications. Each band has distinct characteristics, propagation methods, and uses in communication systems. Syntax // Basic structure for RF band classification if (frequency >= min_freq && frequency = 3000 && freqHz = 30000 && freqHz = 300000 && freqHz = 3000000 && freqHz = 30000000 && freqHz = 300000000 && freqHz = 3000000000 && freqHz = 30000000000 && freqHz

Read More

Introduction to Backtracking

sudhir sharma
sudhir sharma
Updated on 15-Mar-2026 27K+ Views

Backtracking is a systematic technique for solving computational problems by exploring all possible solutions incrementally and abandoning paths that cannot lead to a valid solution. It uses recursive calling to build solutions step by step, removing invalid solutions based on problem constraints. Types of Backtracking Problems Backtracking algorithm is applied to three main types of problems − Decision problems − Find any feasible solution Optimization problems − Find the best solution among all feasible solutions Enumeration problems − Find all feasible solutions to the ...

Read More

Arc function in C

sudhir sharma
sudhir sharma
Updated on 15-Mar-2026 3K+ Views

In C programming, the arc() function is used to draw an arc (a portion of a circle's circumference) on the graphics screen. This function is part of the graphics.h library, which provides various drawing capabilities for creating graphical outputs. Syntax void arc(int x, int y, int startangle, int endangle, int radius); Parameters The arc() function accepts five parameters − x − The x-coordinate of the center of the arc y − The y-coordinate of the center of the arc startangle − The starting angle of the arc in degrees (0-360) endangle − ...

Read More

C/C++ Function Call Puzzle?

sudhir sharma
sudhir sharma
Updated on 15-Mar-2026 283 Views

This C/C++ function call puzzle explores the different behavior of function calling between C and C++ programming languages. The key difference lies in how each language handles function parameters and argument passing. When a function is declared without parameters, C and C++ treat it differently. Let's examine this behavior with a practical example. Syntax return_type function_name(); // Function declaration without parameters Example The following code demonstrates the different behavior when calling a function with arguments that was declared without parameters − #include void method() { ...

Read More

C program to check if a given string is Keyword or not?

sudhir sharma
sudhir sharma
Updated on 15-Mar-2026 14K+ Views

In C programming, a keyword is a predefined or reserved word that has a fixed meaning and is used to perform specific operations. The C language has 32 keywords that cannot be used as variable names or identifiers. Syntax int strcmp(const char *str1, const char *str2); We can check if a string is a keyword by comparing it with all C keywords using the strcmp() function. C Keywords The following table lists all 32 keywords in the C programming language − ...

Read More

Sum of the series 1.2.3 + 2.3.+ ... + n(n+1)(n+2) in C

sudhir sharma
sudhir sharma
Updated on 15-Mar-2026 784 Views

Find the sum up to n terms of the series: 1.2.3 + 2.3.4 + ... + n(n+1)(n+2). In this series, 1.2.3 represents the first term and 2.3.4 represents the second term. Let's see an example to understand the concept better − Input: n = 5 Output: 420 Explanation 1.2.3 + 2.3.4 + 3.4.5 + 4.5.6 + 5.6.7 = 6 + 24 + 60 + 120 + 210 = 420 The nth term = n(n+1)(n+2); where n = 1, 2, 3, ... Expanding: n(n+1)(n+2) = n(n² + 3n + 2) = n³ + ...

Read More

Betrothed numbers in C?

sudhir sharma
sudhir sharma
Updated on 15-Mar-2026 2K+ Views

Betrothed numbers are pairs of numbers where the sum of proper divisors of each number equals the other number plus one. In mathematical terms, for numbers (a, b) to be betrothed: s(a) = b + 1 and s(b) = a + 1, where s(n) represents the sum of proper divisors of n (divisors excluding the number itself). The first few pairs of betrothed numbers are: (48, 75), (140, 195), (1050, 1925), (1575, 1648), (2024, 2295), (5775, 6128). All known pairs have opposite parity − one number is even and the other is odd. Syntax int sumOfProperDivisors(int ...

Read More

Array elements that appear more than once in C?

sudhir sharma
sudhir sharma
Updated on 15-Mar-2026 1K+ Views

An array is a container of elements of the same data type. Elements can appear in any order and frequency within an array. In this article, we will learn how to find elements that appear more than once in an array. Syntax for (i = 0; i < n; i++) { count = 0; for (j = 0; j < n; j++) { if (arr[i] == arr[j]) { count++; ...

Read More

Array sum after dividing numbers from previous in C?

sudhir sharma
sudhir sharma
Updated on 15-Mar-2026 301 Views

In C programming, we can calculate the sum of an array where each element (except the first) is divided by its preceding element. This problem involves integer division, where we only consider the quotient part of the division. Syntax sum = arr[0]; for(i = 1; i < n; i++) { sum += arr[i] / arr[i-1]; } Algorithm The algorithm traverses each element of the array and divides it by the element preceding it. Then, it adds the quotient value to the sum variable − Input : Array - ...

Read More
Showing 121–130 of 975 articles
« Prev 1 11 12 13 14 15 98 Next »
Advertisements