Exercise

1.WAP to find prime buddies(3-5,5-7,11-13)i.e. 2 consecutive odd and prime numbers(pair).


2.
WAP that will take a main string and a sub string and reverses the characters of main string occurred between 1st and 2nd, 3rd and 4th then 5th and 6th and so on occurrences of substring.
          Ex.-
          Main string – abcdefgabcababcasdfabc
          Sub string  -  abc
          o/p:- abcgfedabcababcfdsaabc
3.
WAP that takes an integer number and find all the combinations of two numbers a and b such that their sum leads to entered number and elimination of any of digit in a will give the number equal to b.
          Ex.-
          Number=200
          a=190 b=10
          elimination of 9 in 190 will give 10.
          a=182 b=18
          elimination of 2 in 182 will give 18.
4.
WAP to reverse individual word of given string.
          Ex.-
I/P:- India is my nation.
O/P:- aidnI si ym noitan.
5.
WAP that takes an integer number as size of array and read until whole array contains unique numbers. Remember If array contains duplicate elements,you can't read new elements for that places,you have to read element at he end of the array.
eg- size=10
elements- 1 3 4 5 2 3 4 6 7 7 then next readings will be as 1 3 4 5 2 6 7 newreading1 newreading2 newreading3.

6. Write a program in C to right align an integer range value.
Try this and if you need help then please do post your comment.

No comments:

Post a Comment