From b4339b0c478f04061a8f7f43bb7695765f3bafe0 Mon Sep 17 00:00:00 2001 From: agnesnakalembe <38295251+agnesnakalembe@users.noreply.github.com> Date: Thu, 12 Apr 2018 11:52:40 +0300 Subject: [PATCH 1/4] Question 1 --- main.c | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/main.c b/main.c index d923aa60..e23b1e0c 100644 --- a/main.c +++ b/main.c @@ -1,15 +1,19 @@ -#include -#include - -main(){ - char some_string[] = {}; - for (int i = 0; i < 20; ++i) { - scanf("%s", some_string); - if (some_string[i] == EOF) - { - break; - } - } - putchar(some_string); - -} \ No newline at end of file +//NAME: NAKALEMBE AGNES +//REG_NO: 16/U/811 +//*STUDENT NO:216001305S +//COURSE: COMPUTER ENGINEERING II + +#include + +int x=1; +int main() + +{ +//int x = 1; +if(x==1) +printf ("x equals 1"); +else +printf ("x does not equal 1"); +return 0; +} + From 35093d81f96a6f908a6657127176133117b1db0d Mon Sep 17 00:00:00 2001 From: agnesnakalembe <38295251+agnesnakalembe@users.noreply.github.com> Date: Thu, 12 Apr 2018 11:53:29 +0300 Subject: [PATCH 2/4] Question 2 --- main.c | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/main.c b/main.c index e23b1e0c..f40e1a89 100644 --- a/main.c +++ b/main.c @@ -1,19 +1,12 @@ -//NAME: NAKALEMBE AGNES -//REG_NO: 16/U/811 -//*STUDENT NO:216001305S -//COURSE: COMPUTER ENGINEERING II - +//*NAME:NAKALEMBE AGNES +//*REG NO.16/U/811 +//*STUDENT NO:216001305 #include - -int x=1; +//print_a_number_h int main() - -{ -//int x = 1; -if(x==1) -printf ("x equals 1"); -else -printf ("x does not equal 1"); -return 0; + { + #ifndef PRINT_A_NUMBER_H + #define PRINT_A_NUMBER_H + void print_a_number(int x); + #endif } - From 024a617f89ef82cce8ee485b555bc774cc98af27 Mon Sep 17 00:00:00 2001 From: agnesnakalembe <38295251+agnesnakalembe@users.noreply.github.com> Date: Thu, 12 Apr 2018 11:54:02 +0300 Subject: [PATCH 3/4] Question 3 --- main.c | 35 +++++++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/main.c b/main.c index f40e1a89..d684b4fc 100644 --- a/main.c +++ b/main.c @@ -1,12 +1,27 @@ -//*NAME:NAKALEMBE AGNES -//*REG NO.16/U/811 -//*STUDENT NO:216001305 + +//Answers of question 3: +//i) long values[50]; + +//ii) long values[49] = 123.456; + +//iii) x is equal to 99 when the statement is complete + +//iv) The value of ctr is 8 when the statement is complete + + + + +//v) #include -//print_a_number_h -int main() - { - #ifndef PRINT_A_NUMBER_H - #define PRINT_A_NUMBER_H - void print_a_number(int x); - #endif +main(){ +int x = 1; +while(x <= 100){ +//vi) + printf("The value of x : %d\n ", x); + x += 3; } +} +//Comment: The X will be counted from 1 to 100 by adding 3 + +//vii) We don’t have to put the semicolon to terminate the for loop and the statements for a for loop should be enclosed. + From d6df9f8c8e413858a90928437d4f618df4934228 Mon Sep 17 00:00:00 2001 From: agnesnakalembe <38295251+agnesnakalembe@users.noreply.github.com> Date: Thu, 12 Apr 2018 11:54:33 +0300 Subject: [PATCH 4/4] Question4 --- main.c | 36 +++++++++++++----------------------- 1 file changed, 13 insertions(+), 23 deletions(-) diff --git a/main.c b/main.c index d684b4fc..74eb0d10 100644 --- a/main.c +++ b/main.c @@ -1,27 +1,17 @@ - -//Answers of question 3: -//i) long values[50]; - -//ii) long values[49] = 123.456; - -//iii) x is equal to 99 when the statement is complete - -//iv) The value of ctr is 8 when the statement is complete - - - - -//v) +//NAME: NAKALEMBE AGNES +//REG_NO: 16/U/811 +//COURSE: COMPUTER ENGINEERING II #include -main(){ -int x = 1; -while(x <= 100){ -//vi) - printf("The value of x : %d\n ", x); - x += 3; +#include +int i=0; +int main() +{ + void AddArrays(int array1[], int array2[], int destination_array[], int size) + { + for(i=0;i