C program using pointers to accept two matrices from user


Question 1)a) How we can choice suitable data structures for formulating computer solutions to problems?

b) Design the algorithm to calculate averaging a list of nonnegative numbers.

c) Design the algorithm to convert binary numbers to decimal.

Question 2)a) Explain the qualities and capabilities of any good algorithm?

b) Design the algorithm that counts the number of digits in an integer.

c) Design the algorithm that reads an integer and then prints the largest Fibonacci number less than this integer.

Question 3)a) Differentiate between the following with suitable example

(i) do ...while and while loop

(ii) while and for loop

b) Explain the output that will be generated by following C programs.

(i) #include
int main()
{
int i=0, x=0;
for (i=1; i<10; i*=2)
{x++;
printf("%d",x);
}
printf("\n x=%d",x);
return 0;
}

(ii) #include
int funct (int count);
int main()
{
int a, count;
for (count=1; count<=5; ++ count)
{
a=funct (count);
printf("%d\n", a);
}
}
int funct(int x)
{
int y;
y=x*x;
return y;
}

Question 4)a) Describe various string library functions used in C with appropriate example.

b) Write a C program that reads a string and then prints number of Vowels and Consonants in it.

Question 5)a) What will be the output of the following program? Justify your answer.

(i) #include
int main()
{
char a[]="string", *p="string";
printf("%c %c",1[a], 1[p]);
return 0;
}

(ii) #include
int main()
{
int *a=(1,2,2,2,2), *p;
p=(int*) malloc(10);
printf("%P %p\n", a, p);
return 0;
}

b) Write a C program using pointers to accept two matrices from user and do addition of given matrices.

Request for Solution File

Ask an Expert for Answer!!
C/C++ Programming: C program using pointers to accept two matrices from user
Reference No:- TGS05675

Expected delivery within 24 Hours