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 Bhanu Priya
Page 52 of 107
Explain different types of expressions in C program
An expression in C is a combination of operators and operands that evaluates to a single value. An operand is a data item on which an operation is performed, and an operator indicates the operation to be performed. Syntax operand operator operand operator operand operand ? operand : operand Types of Expressions C Expression Types Primary Unary Binary ...
Read MoreWhat are executable statements in C language?
Executable statements in C are instructions that perform specific actions during program execution. The compiler translates these statements into machine code, which the processor can execute directly. Syntax statement; Types of Executable Statements The main types of executable statements in C language are − Input-output statements Assignment statements Control flow statements Function call statements Input-Output Statements Input-output statements handle data exchange between the program and the user − Input operation − Storing values from external sources into memory Output operation − Displaying computed results to the user ...
Read MoreExplain variable declaration and rules of variables in C language
In C programming, a variable is a named memory location used to store data values. Variables are fundamental building blocks that allow programs to manipulate and store information during execution. What is a Variable? It is the name for memory location that may be used to store a data value. A variable may take different values at different times during execution. A variable name may be chosen by the programmer in a meaningful way, so as to reflect its function or nature in the program. For example: sum, avg, total, price, count etc. Rules ...
Read MoreExplain about link and definition section in C language
In C programming, the link section and definition section are parts of preprocessor directives that provide instructions to the compiler before the actual compilation begins. The link section uses #include directives to include header files containing function declarations and definitions from system libraries. The definition section uses #define directives to create symbolic constants and macros. Syntax #include // Link section #define CONSTANT_NAME value // Definition section Link Section The link section tells the compiler which header files to include. This allows access to predefined functions and their ...
Read MoreC program to handle integer data files using file concepts
In C, file handling allows us to work with different types of data including integers. This program demonstrates how to read integer data from one file and separate odd and even numbers into different files using file concepts. Syntax FILE *fopen(const char *filename, const char *mode); int putw(int w, FILE *stream); int getw(FILE *stream); int fclose(FILE *stream); Approach The program follows these steps − Create a DATA file and write integers to it Read integers from DATA file Separate odd numbers into ODD file and even numbers into EVEN file Display contents ...
Read MoreC program to display the prime numbers in between two intervals
In C programming, finding prime numbers between two intervals is a common problem that involves checking each number in the range for primality. A prime number is a natural number greater than 1 that has no positive divisors other than 1 and itself. Syntax for(i = start + 1; i < end; i++) { flag = 0; for(j = 2; j
Read MoreFind the sum of first and last digit for a number using C language
In C programming, finding the sum of the first and last digit of a number involves extracting these digits using modulus and division operations. The last digit is obtained using modulus 10, while the first digit is found by repeatedly dividing the number by 10. Syntax int lastDigit = number % 10; while(number > 9) { number = number / 10; } int firstDigit = number; int sum = firstDigit + lastDigit; Algorithm The algorithm to find the sum of first and last digit is as follows − ...
Read MoreExplain the different sections in C language
A C program follows a structured format with different sections that serve specific purposes. Understanding these sections helps in writing well-organized and maintainable code. Structure of a C Program The complete C program is divided into different sections, which are as follows − Documentation Section − Contains comments about the program like author name, creation or modification date. Information written between /* */ or after // is called a comment line. These lines are ignored by the compiler during compilation. Preprocessor Directives Section − In this section, header files required to execute the program are ...
Read MoreC program to display only the lower triangle elements in a 3x3 2D array
In a 3x3 matrix, the lower triangle consists of elements where the row index is greater than or equal to the column index (i >= j). This includes the main diagonal and all elements below it. Syntax for(i = 0; i < n; i++) { for(j = 0; j < n; j++) { if(i >= j) // Print element at array[i][j] else ...
Read MoreC program to sort an array of ten elements in an ascending order
An array is a group of related data items that are stored with a single name. In this article, we'll learn how to sort an array of ten elements in ascending order using the bubble sort technique. For example, int student[30]; Here, student is an array name which holds 30 collection of data items with a single variable name. Syntax for(i = 0; i < n-1; i++) { for(j = i+1; j < n; j++) { if(arr[i] > arr[j]) { ...
Read More