diff --git a/Programming/C/Two sum/TwoSum.cpp b/Programming/C/Two sum/TwoSum.cpp new file mode 100644 index 0000000..e97a321 --- /dev/null +++ b/Programming/C/Two sum/TwoSum.cpp @@ -0,0 +1,42 @@ +#include +#include +int main() +{ + int n;//size of the vector + printf("Enter size of the array:\n"); + scanf("%d",&n); + + int numbers[n]; + + int i; + int a=0;//counter variable to break from the loop + + printf("Enter the elements of the array in sorted order: ");//since it is said non-descending order + for(i=0;i