3) Int Matrix of certain size was given, We had few valu=
es in it like this.
=97=97=97=97=97=97=97=97=97=97=97
1 = | 4 | | 5 | &= nbsp; | 45
=97=97=97=97=97=97=97=97=97=97=97
&n= bsp; | 3 | 3 | 5 | = | 4
=97=97=97=97=97=97=97=97=97=97=97
34 |&nbs= p; 3 | 3 | | 12 | &= nbsp;
=97=97=97=97=97=97=97=97=97=97=97
3 | &nbs= p; | 3 | 4 | = | 3
=97=97=97=97=97=97=97=97=97=97=97
3 | = ; | | | = ; 3 |
=97=97=97=97=97=97=97=97=97=97=97
&= nbsp; | | 4 | = ; | 4 | 3
We w= ere supposed to move back all the spaces in it at the
end.
Note: = If implemented this prog using recursion, would get
higher preference.
Answer / Ajay Vikram
To solve this problem recursively, we can create a function that takes a matrix and a row number as input. If the row number is greater than the size of the matrix, return. Otherwise, for each space in the row, if the cell value is not a space character (' '), append it to the result string. Then, call the function recursively for the next row, incrementing the row number by 1. When we reach the last row, reverse the resulting string to move the spaces back to their original positions.
| Is This Answer Correct ? | 0 Yes | 0 No |
Is the following code legal? void main() { typedef struct a aType; aType someVariable; struct a { int x; aType *b; }; }
Given an array of characters which form a sentence of words, give an efficient algorithm to reverse the order of the words (not characters) in it.
how many processes will gate created execution of -------- fork(); fork(); fork(); -------- Please Explain... Thanks in advance..!
why the range of an unsigned integer is double almost than the signed integer.
Write a C program to print ‘Campus Force training’ without using even a single semicolon in the program.
why is printf("%d %d %d",i++,--i,i--);
1) int i=5; j=i++ + i++ + i++; printf("%d",j);This code gives the answer 15.But if we replace the value of the j then anser is different?why? 2)int i=5; printf("%d",i++ + i++ + i++); this givs 18.
main() { unsigned int i=65000; while(i++!=0); printf("%d",i); }
Who could write how to find a prime number in dynamic array?
write a c program to Reverse a given string using string function and also without string function
main() { printf("%d", out); } int out=100;
main( ) { char *q; int j; for (j=0; j<3; j++) scanf(“%s” ,(q+j)); for (j=0; j<3; j++) printf(“%c” ,*(q+j)); for (j=0; j<3; j++) printf(“%s” ,(q+j)); }