From 620139b4641cf40ed5192a62a0bbc37c49a59bdf Mon Sep 17 00:00:00 2001 From: kitaroghope <38127265+kitaroghope@users.noreply.github.com> Date: Thu, 12 Apr 2018 11:29:05 +0300 Subject: [PATCH 1/4] Create question 1 --- question 1 | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 question 1 diff --git a/question 1 b/question 1 new file mode 100644 index 00000000..d1e01ae1 --- /dev/null +++ b/question 1 @@ -0,0 +1,13 @@ +#include +#include + +int main() +{ + int x=1; + if(x==1) + printf("x equals 1"); + else + printf("x does not equal 1"); + + return 0; +} From 5107132062e8f680d6a75d8c39770c85ab02d13f Mon Sep 17 00:00:00 2001 From: kitaroghope <38127265+kitaroghope@users.noreply.github.com> Date: Thu, 12 Apr 2018 11:38:42 +0300 Subject: [PATCH 2/4] Create question 4 --- question 4 | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 question 4 diff --git a/question 4 b/question 4 new file mode 100644 index 00000000..b6f89cc2 --- /dev/null +++ b/question 4 @@ -0,0 +1,48 @@ +section 1 +void addarrays(int 4, int x[],int y[],int z[]){ +int i; +for(i=0; i<4; I++) + +{ + z[i]=x[i]+y[i]; +} + +section 2 +#include +#include +int 4, x; +int *addarrays(int 4,int 3[],int 1[],int z[]){ +int i; +for(i=0; i<4; i++) + { + z[i]=x[i]+y[i]; + } + return 0; +} +void arrays_elements(int N, int a[]){ +for (i=0; i<4 ; i++) + printf("\n%d",a[i]); +} +void print_elements(int 4, int a[]){ + for(i=0; i<4; i++){ +printf("enter element"); +scanf("%d",&a[i]);} + } + int main(){ + int x[4], y[4],z[4]; + printf("enter size of the arrays"); + scanf("%d",&4); + printf("enter elements of the 1st array:\n"); + print_elements(4,x); + printf("enter elements of the array two:\n"); + print_elements(4,y); + int*p; + p=addarrays(4,x,y,z); + printf("elements of array 1 are:\n"); + print_elements(4,x); + printf("elements of array 2 are:\n "); + print_elements(4,y); + printf("elements of array that contain sum are:\n"); + print_elements(4,z); + return 0; + } From 965be059812c8ae602a78114813a45c3c5cf0e66 Mon Sep 17 00:00:00 2001 From: kitaroghope <38127265+kitaroghope@users.noreply.github.com> Date: Thu, 12 Apr 2018 11:44:30 +0300 Subject: [PATCH 3/4] Create question 3 --- question 3 | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 question 3 diff --git a/question 3 b/question 3 new file mode 100644 index 00000000..07daedb5 --- /dev/null +++ b/question 3 @@ -0,0 +1,32 @@ +section 1 +#include +#include +int main() +{ + long a[50];/* an array of size 50 of the type long double*/ + +section 2 + long a[49]=(123.456); + +section 3 + x=100 + +section 4 + ctr=11 + + +section 5 + #include + int main(){ + int count=1; + while(count<=100){ + printf("\n%d",count); + count+=3; + } + return 0; + } + + section 6 + The for loop is not supposed to be terminated. + + From 24c08fee601d94a22f7cbbe6f85c00c1fbf7d063 Mon Sep 17 00:00:00 2001 From: kitaroghope <38127265+kitaroghope@users.noreply.github.com> Date: Thu, 12 Apr 2018 11:58:47 +0300 Subject: [PATCH 4/4] Create question 2 --- question 2 | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 question 2 diff --git a/question 2 b/question 2 new file mode 100644 index 00000000..623ef0b6 --- /dev/null +++ b/question 2 @@ -0,0 +1,15 @@ +/*section 1*/ +#ifndef DO_IT_H +#define DO_IT_H +float do_it(char a, char b, char c); +#endif // DO_IT_H + +/*section 2*/ +#ifndef PRINT_A_NUMBER_H +#define PRINT_A_NUMBER_H +void print_a_number(int x); +#endif // PRINT_A_NUMBER_H + +/*section 3*/ +The print_msg() function is not supposed to take any arguments but the +main function calls it with a string argument. year