-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathex.cpp
More file actions
86 lines (75 loc) · 1.15 KB
/
ex.cpp
File metadata and controls
86 lines (75 loc) · 1.15 KB
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#include<iostream>
using namespace std;
int NewSum(int *a, int *b);
int SumSeq(int *A, int n)
{
int sum;
for(int i = 0; i < n; i++)
{
sum = NewSum(&A[i] , &A[i + 1]);
}
return sum;
}
int NewSum(int *a, int *b)
{
int val = *a + *b;
return val;
}
int main()
{
// int ele1, ele2;
// //int arra[100];
// int product = 3;
//
// cin>>ele1 >> ele2;
//
// if(ele1 > 5)
// {
// if(ele2 > 5)
//
// cout<<"Elements are greater than 5\n";
// }
// else
// cout<<"ele1 is < 5";
//
// while(product <= 100)
// {
// product *= 3;
// }
//
// cout<< product;
// int total = 0;
// for(int num = 2; num <= 20; num += 2)
// {cout<<num;
// total += num;}
// cout<<"\n"<<total;
int arrA[6]= {0,1,2,3,4,5};
for(int k = 0; k < 6; k++)
{
for(int i = 0; i < 6; i++)
{
cout<<arrA[k]<<" ";
cout<<arrA[i];
}
}
cout<<endl<<endl;
for(int i = 0; i < 6; i++)
{
cout<<arrA[i];
}
cout<<endl;
// for(int a : arrA)// range based for loop
// {
cout<<SumSeq(arrA,6);
// }
cout<< "\nLook at this "<<endl;
int ar[8] = {0,1,2,3,4,5,6,7};
for(int i = 0; i < 8; i++)
{
for(int j = i + 1 ; j < 8; j++)
{
cout<<ar[i]<<" "<<ar[j];
}
}
return 0;
}