
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 26504 Articles for Server Side Programming

4K+ Views
The link and definition sections are called as preprocessor directives. It gives instructions to the compiler to link function from the system library.For example, the definition section defines all the symbolic constants.#includeFor example, #define PI 3.1415The preprocessor directives must start with # symbol.Without link definition the program will not execute for some compilers. It helps the compiler to link the predefined functions from system library.Predefined FunctionsThe predefined functions present in stdio.h are as follows −FunctionDescriptionprintf()Print the character, string, float, integer, octal onto the screen.scanf()Read a character, string, numeric data from keyboard.getc()Reads character from file.gets()Reads line from keyboard.getchar()Reads character from keyboard.puts()Writes ... Read More

1K+ Views
In this program, we are trying to sort out the odd numbers and even numbers that are present in one file. Then, we try to write all odd numbers in ODD file and even numbers into EVEN file.Open a file DATA in write mode and write some numbers into the file and later on close it.Again, Open DATA file in read mode.Open ODD file in write mode.Open EVEN file in write mode.Then, perform the operations to check odd and even numbers by using while loop.After that close all files.ExampleFollowing is the C program to handle integer data files using file ... Read More

7K+ Views
The pre-processor is a tool that processes the source code before it passes through the compiler. It work as an initial phase of compilation where it operates under the control of different command lines or directives. Pre-processor Directives in C Pre-processor is placed in the source program before the main line, it begins with the symbol "#" in column one and does not require a semicolon at the end. The commonly used pre-processor directives are − #define #undef #include #ifdef #endif #if #else The pre-processor directives are divided into three categories − Macro substitution directives. File inclusion ... Read More

10K+ Views
Enter two numbers at console during runtime. Then, declare the flag variable which is used to check whether the number is prime or not with the help of for loop condition.Whenever, the flag is zero, it prints the prime number and if flag is one, it exists from the loop.ProgramFollowing is the C program to display the prime numbers in between two intervals − Live Demo#include int main(){ int number1, number2, i, j, flag; printf("enter the two intervals:"); scanf("%d %d", &number1, &number2); printf("prime no’s present in between %d and %d:", number1, number2); for(i=number1+1;iRead More

4K+ Views
The sum of first and last digit for a number can be calculated if we use the below mentioned algorithm in C programming language.AlgorithmRefer an algorithm given herewith −START Step 1: Declare no, sum variables of type int Step 2: Read a number at runtime Step 3: Compute sum=no%10 Step 4: While loop no>9 No=no/10 Step 5: Compute sum=sum+no; Step 6: Print sum STOPExampleFollowing is the C program to find the sum of first and last digit for a number − Live Demo#include int main(){ unsigned int no, sum; printf("enter any number:"); scanf("%u", &no); sum=no%10; ... Read More

10K+ Views
C program is defined by set of protocols that are to be followed by a programmer, while writing the code.SectionsThe complete program is divided into different sections, which are as follows −Documentation Section − Here, we can give commands about program like author name, creation or modified date. The information written in between/* */ or // is called as comment line. These lines are not considered by the compiler while executing.Link section − In this section, header files that are required to execute the program are included.Definition section − Here, variables are defined and initialised.Global declaration section − In this ... Read More

383 Views
If we are generating random numbers in a program, it is necessary to control the series of numbers.The randomize() and srand() functions are used to seed the random number generator.The process of assigning the random number generators starting number is called seeding the generators.The randomize() uses PC’s clock to produce a random seed.srand() allows us to specify the random number generator’s starting value.ProgramGiven below is the C program on rand − Live Demo#include int main(){ // create same sequence of // random numbers on every time the program runs for(int i = 0; i

5K+ Views
Macro substitution is a mechanism that provides a string substitution. It can be achieved through "#deifne".It is used to replace the first part with the second part of the macro definition, before the execution of the program.The first object may be a function type or an object.SyntaxThe syntax for macros is as follows −#define first_part second_partProgramIn the program for every occurrence of first_part is replaced with the second_part throughout the code. Live Demo#include #define square(a) a*a int main(){ int b, c; printf("enter b element:"); scanf("%d", &b); c=square(b);//replaces c=b*b before execution of program printf("%d", c); return 0; }OutputYou will see the following ... Read More

11K+ Views
An array of characters (or) collection of characters is called a string.DeclarationRefer the declaration given below −char stringname [size];For example − char a[50]; string of length 50 characters.InitializationThe initialization is as follows −Using single character constant −char a[10] = { ‘H’, ‘e’, ‘l’, ‘l’, ‘o’ ,‘\0’}Using string constants −char a[10] = "Hello":;AccessingThere is a control string “%s” used for accessing the string, till it encounters ‘\0’.The logic used to count number of vowels is as follows −if(string[i]=='a'||string[i]=='e'||string[i]=='i'|| string[i]=='o'||string[i]=='u')//checking the char is vowel vowel=vowel+1;The logic used to count number of digits is as follows −if(string[i]=='0'||string[i]=='1'||string[i]=='2'|| string[i]=='3'||string[i]=='4'||string[i]=='5'|| string[i]=='6'||string[i]=='7'||string[i]=='8'||string[i]=='9') digit=digit+1;The logic used to ... Read More

417 Views
Let’s take the input of 3x3 matrix, means total 9 elements, in 2D array using keyboard at runtime.With the help of it and for loops, we can display only lower triangle in 3X3 matrix.The logic to print lower triangle elements is as follows −for(i=0;i=2nd index printf("%d",array[i][j]); else printf(" "); //display blank in non lower triangle places } printf(""); }ProgramFollowing is the C program to display only the lower triangle elements in a 3x3 2D array − Live Demo#include int main(){ int array[3][3],i,j; printf("enter 9 numbers:"); for(i=0;i