-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathq4.txt
41 lines (30 loc) · 1.51 KB
/
q4.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
//pritpal Singh
#include<iostream>
using namespace std;
void arrayFunction(int[],int,int); //prototype function that take three arguments
/******************______________________________________******************************/
int main()
{
int n; // n variable to store input form user
const int size=20; // constant size for array
int arr[size]={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20}; // array size of 20 with 20 elements in it;
cout<<"this program will print greater values then your input in between 1 to 20 \n\n"<<"Enter the number between 1 to 20 here :-";
cin>>n;
arrayFunction(arr,size,n);
return 0;
}
/*******************************************************************************************************************************/
void arrayFunction(int arr[],int size,int n) // function that print greater value than input between 1 to 20 only interger values
{
int i; // i variable for using as condition value in for loop
if(n>=size) //if input value is greater than and equal to the size of array this massage will print.
{
cout<<endl<<"sorry there is no greater value exist try smaller value ....."<<endl;
}else // if input is not greater than size of array than this for loop start printing greater elements which are greater than input value
size--;
for(i=n;i<=size;i++)
{
cout<<arr[n] <<endl;
n++;
}
}