From 5f259d91622ed4a39376525d9433abab6b27f5c9 Mon Sep 17 00:00:00 2001 From: arushi-2298 <70422544+arushi-2298@users.noreply.github.com> Date: Thu, 22 Oct 2020 20:03:57 +0530 Subject: [PATCH 1/2] Update Q16_reverse_string.c --- Q16_reverse_string.c | 29 +++++++++-------------------- 1 file changed, 9 insertions(+), 20 deletions(-) diff --git a/Q16_reverse_string.c b/Q16_reverse_string.c index 16834b6..30eb51f 100644 --- a/Q16_reverse_string.c +++ b/Q16_reverse_string.c @@ -1,22 +1,11 @@ -#include -#include -void main() +#include +#include +int main() { - int i, j, k; - char str[100]; - char rev[100]; - printf("Enter a string:\t"); - scanf("%s", str); - printf("The original string is %s\n", str); - for(i = 0; str[i] != '\0'; i++); - { - k = i-1; - } - for(j = 0; j <= i-1; j++) - { - rev[j] = str[k]; - k--; - } - printf("The reverse string is %s\n", rev); - getch(); + char s[100]; + printf("Enter a string\n"); + gets(s); + strrev(s); + printf("Reverse string is: %s\n", s); + return 0; } From 050c0fc2d3c6a52a81fde2925df98c472c5e7550 Mon Sep 17 00:00:00 2001 From: arushi-2298 <70422544+arushi-2298@users.noreply.github.com> Date: Thu, 22 Oct 2020 20:12:36 +0530 Subject: [PATCH 2/2] Create check if the number formed by the last digit of each element of an array is divisible by 10 or not --- ... element of an array is divisible by 10 or not | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 check if the number formed by the last digit of each element of an array is divisible by 10 or not diff --git a/check if the number formed by the last digit of each element of an array is divisible by 10 or not b/check if the number formed by the last digit of each element of an array is divisible by 10 or not new file mode 100644 index 0000000..45eb92a --- /dev/null +++ b/check if the number formed by the last digit of each element of an array is divisible by 10 or not @@ -0,0 +1,15 @@ +#include +int main() +{ + int a[100],i,n; + printf("enter size of array\n"); + scanf("%d ", &n); + printf("enter array\n"); + for(i=0;i