/* The following C/C++ program will print the table of any number entered. The following program can be extended to print tables for 'n' numbers by inserting the table() function in a loop or making multiple call of it */

/* “fstream" class is used for both reading and writing a file. So we need to copy the contents of a file into another file than we will
use “fstream”, it has functions capable of both reading & writing in the file. NOTE: both the text file has to be present initially. */

Code:#include<iostream>#include<conio.h>#include<fstream>using namespace std;int main (){fstream a,b;char ch;a.open("bunty.txt"); //The file from which the content will be copiedb.open("babli.txt");//The file to which the content will be copiedwhile (!a.eof()){a.get(ch); //reading from file object 'a'cout<<ch;b<<ch; //writing to file babli.txt}a.close();b.close();return 0;}

/* The following C / C++ program require user to enter the elements
of arrays having equal number of array elements. Equal number of array
elements are required in this program. This program can be extended to
any of the data type & to the 'n' number of arrays simultaneously*/

/* The following C / C++ program require user to enter the elements of arrays having equal number of array elements. Equal number of array elements are required in this program. This program can be extended to any of the data type & to the 'n' number of arrays simultaneously*/

/* The following program will ask the user to enter the elements of the integer array & then will return the total sum of the array elements. The following program could be expanded to calculate the sum of 'n' number of arrays & also in order to save the memory we can reuse the same array. Of the data is not required further */

/* The following C / C++ Program will find the smallest number among
numbers in the integer array thus entered by the user. We have used
while loop to read & write the array*/

Code:-#include<iostream>#include<conio.h>using namespace std;void main (){int a[100];int min,b=0,c,n;cout<<"\nEnter the total number of elements in array(<100):";cin>>n;while (b<n){cout<<"Enter the element number "<<b<<" : ";cin>>c;a[b]=c;b=b+1;}b=0;min=a[b]; //assuming that the 1st element is the minimumwhile (b<n){if (a[b]<=min) //if anything else is found to be more larger than the current minimum{min=a[b];}b=b+1;}cout<<"\nSmallest number is : "<<min;getche();}

Output:

C / C++ Program to find the Smallest number from the array of integers

/* The following C / C++ Program will find the largest number among numbers in the integer array thus entered by the user. We have used while loop to read & write the array*/

Code:-#include<iostream>#include<conio.h>using namespace std;void main (){int a[100];int max,b=0,c,n;cout<<"\nEnter the total number of elements in array(<100):";cin>>n;while (b<n){cout<<"Enter the element number "<<b<<" : ";cin>>c;a[b]=c;b=b+1;}b=0;max=a[b]; //assuming that the 1st element is the maximumwhile (b<n){if (a[b]>=max) //if anything else is found to be more larger than the current maximum{max=a[b];}b=b+1;}cout<<"\nLargest number is : "<<max;getche();}

/* The Program will first ask the user to enter the maximum limit of the array. Then the user is allowed to enter the array elements specified. The program will remove any of the element which is present in it more than once. Hence the result thus produced is free from duplicate elements */
//CODE:-#include<stdio.h> #include<stdlib.h>int main() { int n, a[10], b[10], count = 0, c, d; printf("Enter number of elements:"); scanf("%d",&n); printf("Enter %d integers\n", n); for(c=0;c<n;c++) scanf("%d",&a[c]); //Getting the array elements for(c=0;c<n;c++) //For removing duplicate elements { for(d=0;d<count;d++) { if(a[c]==b[d]) break; } if(d==count) { b[count] = a[c]; count++; } } printf("Array after removing duplicate elements\n"); for(c=0;c<count;c++) printf("%d\t",b[c]);

system("pause"); return 0; }

SCREENSHOT:

C / C++ Program Code To Remove Duplicate Elements From An Array Of Integers: Output after removing duplicate elements