Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions question 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#include <stdio.h>
#include <stdlib.h>

int main()
{
int x=1;
if(x==1)
printf("x equals 1");
else
printf("x does not equal 1");

return 0;
}
15 changes: 15 additions & 0 deletions question 2
Original file line number Diff line number Diff line change
@@ -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
32 changes: 32 additions & 0 deletions question 3
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
section 1
#include <stdio.h>
#include<stdlib.h>
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<stdio.h>
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.


48 changes: 48 additions & 0 deletions question 4
Original file line number Diff line number Diff line change
@@ -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 <stdio.h>
#include <stdlib.h>
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;
}