From 87aeb05c00573cd12df15311b807e7657e4bf79b Mon Sep 17 00:00:00 2001 From: mhd0774556066 <38225817+mhd0774556066@users.noreply.github.com> Date: Thu, 12 Apr 2018 12:05:02 +0300 Subject: [PATCH 1/4] Create QUESTION FOUR --- QUESTION FOUR | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 QUESTION FOUR diff --git a/QUESTION FOUR b/QUESTION FOUR new file mode 100644 index 00000000..763ead82 --- /dev/null +++ b/QUESTION FOUR @@ -0,0 +1,33 @@ +#include +void addarrays(int array1[], int array2[], int destination_array[], int SIZE) +{ + for(int i=0;i +int *addarrays(int arraya[],int arrayb[], int SIZE); +main(){ +int arraya[] = {2,3,5,9,10}; +printf("arraya[2,3,5,9,10]\n"); +int arrayb[] = {10,23,25,17,16}; + printf("arrayb[10,23,25,17,16]\n"); + printf("arrayc "); +int *arrayc = addarrays(arraya, arrayb, 5); +int i; +for( i=0;i<5;i++) { +printf("%d,", arrayc[i]); +} +} + +int *addarrays(int arraya[], int arrayb[], int length){ +int *destination_array = malloc(length * sizeof(int)); +int i; +for( i=0;i Date: Thu, 12 Apr 2018 12:06:25 +0300 Subject: [PATCH 2/4] Create QUESTION ONE --- QUESTION ONE | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 QUESTION ONE diff --git a/QUESTION ONE b/QUESTION ONE new file mode 100644 index 00000000..5054599c --- /dev/null +++ b/QUESTION ONE @@ -0,0 +1,17 @@ +#include +#include +main() +{ + int x = 1; + + if(x==1) + { + printf("x equals 1"); + } + else + { + printf("x does not equal 1"); + } + return 0; +} + From d0260fcf2a58bc2effb33a971c2aceab0457100c Mon Sep 17 00:00:00 2001 From: mhd0774556066 <38225817+mhd0774556066@users.noreply.github.com> Date: Thu, 12 Apr 2018 12:07:46 +0300 Subject: [PATCH 3/4] Create QUESTION TWO --- QUESTION TWO | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 QUESTION TWO diff --git a/QUESTION TWO b/QUESTION TWO new file mode 100644 index 00000000..24950ccf --- /dev/null +++ b/QUESTION TWO @@ -0,0 +1,7 @@ +do_it() +//the header for above function is as below +float do_it(char a,char b,char c) + +print_a_number() +//the header for the above function is as below +void print_a_number(int x) From 2cf6125acd74e8a90cd4ef432405f914cb07c0e8 Mon Sep 17 00:00:00 2001 From: mhd0774556066 <38225817+mhd0774556066@users.noreply.github.com> Date: Thu, 12 Apr 2018 12:09:24 +0300 Subject: [PATCH 4/4] Create QUESTION THREE --- QUESTION THREE | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 QUESTION THREE diff --git a/QUESTION THREE b/QUESTION THREE new file mode 100644 index 00000000..057921b5 --- /dev/null +++ b/QUESTION THREE @@ -0,0 +1,24 @@ +/*declaration of an array that will hold type long values*/ +long people[50]; + +/* A statement that assigns a value of 123.456 to the 50th element in the array*/ +long people[49]=123456; + +/* what is the value of x whenthe following statement is complete*/ +for(x=0;x<100,x++) /* The final value of x is 100 */ + +/* What is the value of ctr when the following statment is complete */ +for(ctr=2;ctr<10;ctr+=3) /* The final value of ctr is 11 */ + + /* A while statement to count from 1 to 100 in intervals of 3s */ + int x=1; + while(x<=100) + { + printf("%d",x); + x+=3; + } + + /* What is wrong with the folowing code fragment(MAXVALUES is the problem!)*/ + for(counter=1;counter