diff --git a/Question 1 b/Question 1 new file mode 100644 index 00000000..1431b8a1 --- /dev/null +++ b/Question 1 @@ -0,0 +1,10 @@ + +# include < stdio.h > + +Int x=1; +Main ( ) +{ +If (x=1) +Printf(“x equals 1); +Else +Printf( “x does not equal to 1”) diff --git a/Question 2 b/Question 2 new file mode 100644 index 00000000..9645d5ac --- /dev/null +++ b/Question 2 @@ -0,0 +1,18 @@ + + a) Float do-it( char a , char b, char b) + + b) int print- a-number ( int a) + +(c) # include + +Void print_msg(void); + +Main() { +Print_ msg(); +Return 0; +} + +void print_msg(void) { +puts(“This is the message to print”); +getch (); +} diff --git a/Question 3 b/Question 3 new file mode 100644 index 00000000..e9c8c69c --- /dev/null +++ b/Question 3 @@ -0,0 +1,19 @@ + + a) Long array [50]; + + b)Float array 1[49]= 123.456 + + c)X is from 0-99 + +d) Its 2,5,8 +e) + #include + main() + { + int count=1; + while(count<=100){ + printf("%d",count); + count+=3; + } + + f) Termination of the for loop diff --git a/Question 4 b/Question 4 new file mode 100644 index 00000000..d3b732fc --- /dev/null +++ b/Question 4 @@ -0,0 +1,69 @@ + +Question 4(a) + +#include +#include +void addarrays(int A[],int B[],int size); +int main() +{ + int A[5],B[5],C[5],i; + printf("Enter the array A:\n"); + for(i=0;i<5;i++) + { + scanf("%d",&A[i]); + } + + printf("Enter the array B:\n"); + for(i=0;i<5;i++) + { + scanf("%d",&B[i]); + } + addarrays(A,B,5); + + return 0; +} +void addarrays(int A[],int B[],int size) +{ + int i,C[size]; + for(i=0;i<5;i++) + { + C[i]=A[i]+B[i]; + } + for(i=0;i<5;i++) + { + printf("%d ",C[i]); + + } + return 0; + + Question 4(b) + +}#include + void Array_sum(){ + int A[3],B[3],C[3],i; + int *p; + printf("\n enter the values of A: "); + for(i=0;i<3;i++){ + scanf("%d",&A[i]); + } + printf("enter the values of B"); + for(i=0;i<3;i++){ + scanf("%d",&B[i]); + } + for(i=0;i<3;i++){ + C[i]=A[i]+B[i]; + + } + + printf("\n the sum of arrays A + B = \n"); + for(i=0;i<3;i++){ + p=&C[i]; + printf("%d\t\n",*p); + } +} +int main(){ + Array_sum(); + return 0; +} + +