From ca1d3bf6cad215ea04693fd67da4bed589f39d67 Mon Sep 17 00:00:00 2001 From: Priyanshu Sharma <85648078+Priyanshu-792@users.noreply.github.com> Date: Sun, 10 Oct 2021 11:01:26 +0530 Subject: [PATCH] feat: Two sum problem solved in C (aditya109#461) Signed-off-by: Priyanshu Sharma (#514) --- Programming/C/Two sum/TwoSum.cpp | 42 ++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 Programming/C/Two sum/TwoSum.cpp 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