#include<iostream> using namespace std; int positive=0,negative=0,zero=0,number; char choice='y'; int main(){ cout<...
Linear searching of arrays
#include<iostream> using namespace std; int sum=0,ar[10],value,found=0; int main(){ for(int x=0;x<10;x++){ cout<<...
3x3 matrix addition using arrays
#include<iostream> using namespace std; int matr[3][3]; int matr2[3][3]; int matr3[3][3]; int main(){ cout<<"enter ...
simplest multidimension array example
#include<iostream> using namespace std; #include<iomanip> int main(){ int a[3][6]={{1,2,3,4,5,6},{7,8,9,10,11,12}}; for(i...
simple calculator using function
#include<iostream> using namespace std; void calculate(); void choices(); void num(); int choice, a,b; int main(){ choices(); ...
Making diamond using *
#include<iostream> using namespace std; int rows,row; int main(){ cout<<"enter number of rows "<<endl; ...
SIMPLE PREPROCESSOR USE
#include<iostream> using namespace std; #define add(a,b) a+b #define subtract(a,b) a-b #define multiply(a,b) a*b #define divide(a...
SORTING ARRAY USING INNSERTION SORT
#include <iostream> using namespace std; int arr[5]; int main(){ cout<<"enter 5 random numbers that you want to so...
Factorial of a number using loops
#include <iostream> using namespace std; int number,factorial; int main(){ cout<<"enter number for which you want...
sum of number using loop eg: 12345=1+2+3+4+5
#include <iostream> using namespace std; int num,dividenum=1,modulusnum,sum=0; int main(){ cout<<"enter a fi...
USING RECURSION TO GET SUM e.g 12345=1+2+3+4+5=15.
#include <iostream> using namespace std; int num; int number(int num); int main(){ for(int x=0;x<=10;x++){ cout<...
Subscribe to:
Posts (Atom)