Forum     

Go Back   Digit Technology Discussion Forum > Software > Programming
Register FAQ Calendar Mark Forums Read

Programming The destination for developers - C, C++, Java, Python and the lot


Closed Thread
 
LinkBack Thread Tools Display Modes
Old 24-06-2008, 02:25 PM   #1 (permalink)
Right Off the Assembly Line
 
Join Date: Dec 2007
Posts: 8
Default Better solution


Some good question asked at rgec meerut.You can download their solution at
http://www.goelc.blogspot.com/
please provide me better solution for these questions
Phase 1
Q:1‐>WAP TO FIND OUT THAT IS NO IS POWER OF TWO OR NOT. (WITHOUT USING LOOP)
Q:2‐> WAP TO PRINT THE ALL COMBINATION OF STRING “ABC”.
Q:3‐>WAP TO DO THE SUM OF ALL DIGITS OF A NO UNTILL ANS HAS ONLY ONE DIGIT(WITHOUT
USING LOOP)
EX:‐5699
=>5+6+9+9=29
=>2+9=11
=>1+1=2
Q:4‐>WAP TO PRINT STRUCTURE LIKE
1
2 2
3 3 3
4 4 4 4
Q:5‐>WAP TO REMOVE THE FROM THE SENTENCE ENTER BY THE USER.
EX:‐> THIS IS THE TABLE.
=>THIS IS TABLE




PHASE 2
Q:1‐>WAP TO PRINT THE FILE NAME FROM WHICH PROGRAM IS EXECUTED.
Q:2‐>WAP TO MAKE A STRING PALINDROME
EX:‐>IIT
=> ITI
Q:3‐>WAP TO PRINT SPARSE MATRIX
EX:‐>
1 2 3 4
12 13 14 5
11 16 15 6
10 9 8 7
goelvivek is offline  
Advertisements. Register and be a member of the community to get rid of them.
Advertisement

Old 25-06-2008, 09:13 PM   #2 (permalink)
Commander in Chief
 
QwertyManiac's Avatar
 
Join Date: Jul 2005
Posts: 6,658
Default Re: Better solution

P1:

1. Number & Number-1 == 0 (For Number to be power of 2)

2. Permutation Algorithm at Wikipedia or look for an example with standard C++ here.

3. You're using recursion instead of loop. Clever enough I'd say.

4. Triangles, meh. Anything that gives that output will do.

5. String Class function - replace (C++). Replace "THE " with "" and for safety, check "THE" with "" too. ("" is null string, and the second "THE" is without the trailing space)

Will check up on Phase 2 later, but by the looks of it, its good enough. Not checked in detail as I haven't attempted the last two ones yet.
__________________
Harsh J
www.harshj.com
QwertyManiac is offline  
Old 15-07-2008, 03:09 PM   #3 (permalink)
Right Off the Assembly Line
 
Join Date: Dec 2007
Posts: 8
Default Re: Better solution

i m waiting for your second phase answers
goelvivek is offline  
Closed Thread

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Please tell me the solution. mobilogist Software Q&A 4 03-05-2008 06:38 AM
Best Solution eggman Chit-Chat 7 26-08-2007 08:04 PM
Need a solution rajas700 Open Source 1 07-09-2005 12:23 AM
Need a solution rajas700 QnA (read only) 3 26-08-2005 09:14 PM

 
Latest Threads
- by Sujeet
- by clmlbx
- by Sujeet
- by icebags

Advertisement




All times are GMT +5.5. The time now is 11:04 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.

Search Engine Optimization by vBSEO 3.3.2