From 670c449f05de18681b9a53c5880139c7ede78b4b Mon Sep 17 00:00:00 2001 From: Prateekgupta9819 <36070161+Prateekgupta9819@users.noreply.github.com> Date: Tue, 30 Oct 2018 12:32:21 +0530 Subject: [PATCH 1/3] Update C_largest.c --- C/C_largest.c | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/C/C_largest.c b/C/C_largest.c index 9ea244c..a1c4d64 100644 --- a/C/C_largest.c +++ b/C/C_largest.c @@ -1,19 +1,11 @@ -#include +#include +using namespace std; int main() { - double n1, n2, n3; - - printf("Enter three different numbers: "); - scanf("%lf %lf %lf", &n1, &n2, &n3); - - if( n1>=n2 && n1>=n3 ) - printf("%.2f is the largest number.", n1); - - if( n2>=n1 && n2>=n3 ) - printf("%.2f is the largest number.", n2); - - if( n3>=n1 && n3>=n2 ) - printf("%.2f is the largest number.", n3); - + int arr[3]; + cout<<"Enter three different numbers: "; + cin>>arr[0]>>arr[1]>>arr[2]; + sort(arr,arr+3); + cout<<"Largest Element is "< Date: Tue, 30 Oct 2018 12:44:22 +0530 Subject: [PATCH 2/3] Update CPP_linear_search.cpp --- CPP/CPP_linear_search.cpp | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/CPP/CPP_linear_search.cpp b/CPP/CPP_linear_search.cpp index 78a81c1..0a7f8f8 100644 --- a/CPP/CPP_linear_search.cpp +++ b/CPP/CPP_linear_search.cpp @@ -3,7 +3,7 @@ using namespace std; int main() { - int arr[10], i, num, n, c=0, pos; + int arr[10], i, num, n, f=0, pos; cout<<"Enter the array size : "; cin>>n; cout<<"Enter Array Elements : "; @@ -13,22 +13,16 @@ int main() } cout<<"Enter the number to be search : "; cin>>num; - for(i=0; i Date: Tue, 30 Oct 2018 12:44:46 +0530 Subject: [PATCH 3/3] Update CPP_linear_search.cpp --- CPP/CPP_linear_search.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CPP/CPP_linear_search.cpp b/CPP/CPP_linear_search.cpp index 0a7f8f8..1c7c5a8 100644 --- a/CPP/CPP_linear_search.cpp +++ b/CPP/CPP_linear_search.cpp @@ -3,7 +3,7 @@ using namespace std; int main() { - int arr[10], i, num, n, f=0, pos; + int arr[10], i, num, n, f=0; cout<<"Enter the array size : "; cin>>n; cout<<"Enter Array Elements : "; @@ -13,7 +13,7 @@ int main() } cout<<"Enter the number to be search : "; cin>>num; - for(int i=0;i