diff --git a/number 2 b/number 2 new file mode 100644 index 00000000..db7e7176 --- /dev/null +++ b/number 2 @@ -0,0 +1,32 @@ +Number 2a solution; + + +float do_it(char A,char B,char C) + + +Number 2b solution; + + +void print_a_number (int a) + +number 2c sln; + +#include +void print_msg(void); + +main() +{ + print_msg(); + return 0; +} + +void print_msg(void) +{ + puts("This is a message to print"); + return 0; +} +/*the function name must be the same. it was wrong to put print_msq instead of print_msg*/ + +/* so the above program corrected prints 'This is a message to print'*/ +/*the funtion has arguments yet the declaration function had no arguments*/ + diff --git a/number 3 b/number 3 new file mode 100644 index 00000000..778163c4 --- /dev/null +++ b/number 3 @@ -0,0 +1,96 @@ +Number 3a solution; + +float a[50] + + +Number 3b solution; + +a[49]=123.456; + + + +number 3c sln; + +#include +#include + +int main() +{ + int x; + for(x=0;x<100;x++) + printf("%d\n",x); + return 0; +} + +/* 0<=x<=99*/ + + +number 3d sln; + +#include + +int main() +{ + int ctr; + + for(ctr=2;ctr<10;ctr+=3) + + printf("%d\n",ctr); + + return 0; +} +/*the value of ctr is 2,5 and 8*/ + + +number 3e sln; + +#include + +int main() +{ + int b=1; + +while (b<=100) +{ + printf("%d\n",b); + + b+=3; + + } + + return 0; +} +/*the values of x ranged 1<=x<=100*/ + + +number 3f sln; + + +#include +#include + +int main() +{ + int counter + + for(counter=1; counter +#include +int N, i; +int *addarrays(int N,int x[],int y[],int z[]){ +int i; +for(i=0; i +int x=1; +main() +{ + if(x==1) + printf("x equals 1"); + else + printf("x does not equal 1"); + return 0; +} + +/* the program initially had 'if (x=1)' which is simply an assignment operator not the equals sign*/ +/* the word 'otherwise' was used instead of 'else'*/