C-programming

Bitwise operators

C++ bitwise operators

Bit manipulation operators manipulate individual bits within a variable. #include <iostream.h> void main() { unsigned int num=2; unsigned int shift=1; num = num << shift;   ..

Logical operator

C++ logical operator

The logical operators are used to combine two or more test expressions. The logical operators of c++ are ! (not), && (and), || (or).\\ #include void main() { int num; cout num;   ..

Logical operartor

C++ logical operator

The logical operators are used to combine two or more test expressions. The logical operators of c++ are ! (not), && (and), || (or).\ #include <iostream.h> void main() { int num; cout << "Enter the number:"<<  ..

Relational operator

C++ relational operator

relational operator defines some kind of relation between two entities.The relational operators in c++ are == (equal to), != (Not equal to), < (Less than), > (greater than), = (greater than or equal to).The result of a relational operator is either 0 or 1. #include <iostream.h> int main(  ..

Increment decrement operator

C++ increment decrement operator

Adding 1 to a variable is called incrementing and subtracting 1 from a variable is called decrementing. Incrementing or decrementing can be done only on integer values and not on floating point values. Incrementing/decrementing can be done either before or an operation or after the operation and its named as prefix  ..

Arithmetic operators

C++ arithmetic operator

Arithmetic operators Arithmetic operators are used to form arithmetic statements which does the mathematical operations. Arithmetic operators supported in c++ are addition (+), subtraction (-), multiplication (*), division (/), modulo (%). Operations of addition, subtraction, multiplication and division literally correspond with their respective mathematical operators whereas modulo is the operation that gives  ..

Assignment operator

C++ assignment operator

The assignment operator '=' is the operator used for assignment. Using the assignment operator, the value from the source (left side) is copied to the destination (right side). The following program illustrates the usage of assignment operator #include <iostream.h> #include <conio.h> int main( ) {   ..

Global variables

C++ global variables

Global Variable Variables declared outside of a block are called global variables. Global variables have program scope, which means they can be accessed everywhere in the program, and they are only destroyed when the program ends. #include <iostream.h> float pi = 3.14; int circlearea() int  ..

Local variables

C++ local variables

Local Variable A local variable is a variable that is given local scope ie a variable is accessible only from the function or block in which it is declared. Local variables must always be defined at the top of a block. #include <iostream.h> int local()   ..

Reversing an array

C program to reverse an array

This program- reversing an array, reverses the order of the elements in an array. #include<stdio.h> #include<conio.h> void main() { int a[100],i,n; printf("enter no of elements"); scanf("%d",&n); printf("enter the elements of the array") for(i=0;i<=n;i++) scanf("%d",&a[i]); printf("elements in reversed order is ") for(i=n;i>=0;i--) printf("%d",a[i]); } Array of elements is got from the user through a for loop. Now using another for loop and by decrementing  ..

To find smallest number in an array

C program to find smallest number

This program finds the smallest of numbers #include<stdio.h> #include<conio.h> main() { int array[100], minimum, size, c, location = 1; printf("Enter the number of elements in array\n"); scanf("%d",&size); printf("Enter %d integers\n", size); for ( c  ..

To find largest number in an array

C program to find largest number

This program finds the largest number in a given array of numbers. #include<stdio.h> #include<conio.h> main() { int array[100], maximum, size, c, location = 1; printf("Enter the number of elements in array\n"); scanf("%d",&size); printf("Enter %d numbers\n", size);   ..

Armstrong number in C

C program to find armstrong number

#include Armstrong numbers are the sum of their own digits to the power of the number of digits. For example consider 153, where 1^3+5^3+3^3= 153. #include<conio.h> #include<conio.h> main() { int number, sum = 0, temp, remainder; printf("Enter a number\n"); scanf("%d",&number);   ..

To check whether the number is palindrome

C program to check palindrome

A palindromic number or numeral palindrome is a 'symmetrical' number like 1221, that remains the same when its digits are reversed. To check whether a number is palindrome or not first we reverse it and then compare the number obtained with the original, if both are same then number is palindrome  ..

Reversina a number in C

C program for reversing a number

This program reverses the given number. For example if user enter 78 as input then 87 is printed as output. Modulus operator is used for obtaining the digits one by one. #include<stdio.h> #include<conio.h> main() { int n, rev = 0; printf("Enter a number to reverse\n"); scanf("%d",&n);   ..

Previous 1 2 3 4 Next

Tech Bluff