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
Server Side Programming Articles - Page 1246 of 2650
667 Views
Else − if the ladder is the most general way of writing a multi-way decision.The syntax for else if the ladder is as follows −if (condition1) stmt1; else if (condition2) stmt2; - - - - - - - - - - else if (condition n) stmtn; else stmt x;FlowchartRefer the flowchart given below −ExampleFollowing is the C program to execute Else If Ladder conditional statement − Live Demo#include void main (){ int a, b, c, d; printf("Enter the values of a, b, c, d: "); scanf("%d%d%d%d", ... Read More
1K+ Views
The different data types that we use in C programming are integer, short int, Signed and un signed char etc.Data TypesData type specifies the set of values and the type of data that can be stored in a variable. They allow the programmer to select the type appropriate to the needs of application.The data types are as follows −Primary data typesDerived data typesLet us understand primary data types.Primary data types‘C’ compilers support four fundamental data types. They are mentioned below −integercharacterFloating – pointDouble precision floating pointIntegral data typeIntegral data types are used to store whole numbers and characters. It is ... Read More
974 Views
ProblemWhat is the simple program to show the left, right shifts, and complement of a number by using C language?SolutionLeft ShiftIf the value of a variable is left-shifted one time, then its value gets doubled.For example, a = 10, then a1 = 5ExampleFollowing is the C program for the shift operations − Live Demo#include main (){ int a=9; printf("Rightshift of a = %d",a>>1);//4// printf("Leftshift of a = %d",a2);//2// printf("Leftshift by 2 of a = %d",a
3K+ Views
Fibonacci Series is a sequence of numbers obtained by adding the two previous numbers.Fibonacci series starts from two numbers f0 & f1.The initial values of fo & f1 can be taken 0, 1 or 1, 1 Fibonacci series satisfies the following conditions −fn = fn-1 + fn-2AlgorithmRefer to the algorithm for the Fibonacci series.START Step 1: Read integer variable a, b, c at run time Step 2: Initialize a=0 and b=0 Step 3: Compute c=a+b Step 4: Print c Step 5: Set a=b, b=c Step 6: Repeat 3 to 5 for n times STOPExampleFollowing is the C program for the ... Read More
3K+ Views
ProblemHow to write a C program to count numbers of vowels and consonants in a given string?SolutionThe logic that we will write to implement the code to find vowels and consonants is −if(str[i] == 'A' || str[i] == 'E' || str[i] == 'I' || str[i] == 'O' || str[i] == 'U'||str[i] == 'a' || str[i] == 'e' || str[i] == 'i' || str[i] == 'o' || str[i] == 'u' )If this condition is satisfied, we try to increment the vowels. Or else, we increment the consonants.ExampleFollowing is the C program to count the number of vowels and consonants in a ... Read More
13K+ Views
The structure is a collection of different datatype variables, grouped together under a single name. It is a heterogeneous collection of data items that share a common name.Features of structureIt is possible to copy the contents of all structural elements of different data types to another structure variable of its type by using an assignment operator.To handle complex datatypes, it is possible to create a structure within another structure, which is called nested structures.It is possible to pass an entire structure, individual elements of structure, and address of structure to a function.It is possible to create structure pointers.The general form ... Read More
7K+ Views
The malloc() function stands for memory allocation, that allocate a block of memory dynamically.It reserves the memory space for a specified size and returns the null pointer, which points to the memory location.malloc() function carries garbage value. The pointer returned is of type void.The syntax for malloc() function is as follows −ptr = (castType*) malloc(size);ExampleThe following example shows the usage of malloc() function. Live Demo#include #include #include int main(){ char *MemoryAlloc; /* memory allocated dynamically */ MemoryAlloc = malloc( 15 * sizeof(char) ); if(MemoryAlloc== NULL ){ printf("Couldn't able to allocate requested memory"); }else{ ... Read More
376 Views
Leap year is a year that consists of 366 days. For every four years, we will experience a leap year.The logic we will implement to find whether the given year by the user through the console is a leap or not −if (( year%400 == 0)|| (( year%4 == 0 ) &&( year%100 != 0)))If this condition is satisfied, then the given year is a leap year. Otherwise, it is not.ExampleFollowing is the C program to check leap year with the help of If condition − Live Demo#include int main(){ int year; printf("Enter any year you wish ... Read More
82K+ Views
A for loop is a repetition control structure that allows you to efficiently write a loop that needs to execute a specific number of times.AlgorithmGiven below is an algorithm to print multiplication table by using for loop in C language −Step 1: Enter a number to print table at runtime. Step 2: Read that number from keyboard. Step 3: Using for loop print number*I 10 times. // for(i=1; i
21K+ Views
A calculator is a simple tool that helps us to calculate mathematical operations easily and quickly. A basic calculator can perform simple arithmetic operations like subtraction, addition, multiplication, and division. Begin by writing the C code to create a simple calculator. Then, follow the algorithm given below to write a C program. Algorithm Step 1: Declare variables Step 2: Enter any operator at runtime Step 3: Enter any two integer values at runtime Step 4: Apply switch case to select the operator: // case '+': result = num1 + num2; ... Read More