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 sudhir sharma
Page 13 of 98
Binary Search for Rational Numbers without using floating point arithmetic in C program
In this problem, we are given a sorted array of rational numbers and we have to search the given element using binary search algorithm without using floating point arithmetic. A Rational number is a number represented in the form p/q where both p and q are integers. For example, 2/3, 1/5. Binary search is a searching technique that works by finding the middle of the array and comparing elements to determine which half contains the target. For finding the element using binary search from a sorted array of rational numbers, where floating point arithmetic is not allowed, ...
Read MoreC program to delete a file
In programming, working with files is very important and every programming language has its own set of functions or library that help in manipulation of files. In C Programming Language, the remove() function can be used by the programmer to delete a file. Syntax int remove(const char *filename); Parameters The function accepts one parameter which is the name of the file that is to be deleted. File name can also be the path to the file but only if the system supports it. filename − A string containing the name of the ...
Read MoreBash program to check if the Number is a Prime or not
A prime number is a natural number greater than 1 that has exactly two factors: 1 and itself. Examples include 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, etc. In this article, we'll write a C program to check if a given number is prime or not. Syntax for (i = 2; i
Read Morebar() function in C graphics
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 MoreBands in Radio frequency Spectrum in C program
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 MoreIntroduction to Backtracking
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 MoreArc function in C
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 MoreC/C++ Function Call Puzzle?
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 MoreC program to check if a given string is Keyword or not?
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 MoreSum of the series 1.2.3 + 2.3.+ ... + n(n+1)(n+2) in C
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