Hunt for India's Best Academic Project Contest - 2015

Important Links To Visit: 


Click: List of Shortlisted Participants | Click: Round II Details (Important) 


Beginners Tutorial : The C-language.

Discussion in 'Computer Science | IT | Networking' started by simplycoder, Aug 19, 2011.

  1. SamiZzY

    SamiZzY Apprentice

    i replaced the l.h.s index with original index int the last line(is that what you meant?:confused: ) , and the output was 24 and 81. pretty strange because index changes from 100 to 999 but thankyou for the reply mr.jeffrey :)
  2. Code:
    digit=index%10;// Replace this index
    index=index/10;// and also here both the index has to be varied
    Cos your program is having a logical error since you are manipulating the the control variable of the outer loop in the inner most loops So you are getting an error here
    • Like Like x 1
  3. SamiZzY

    SamiZzY Apprentice

    thankyou sir.! noting what you said , replaced all the var index with original index in the 2nd loop
    and at the bottom if condition replaced original index with var index and by god's grace it worked .!
    thankyou again.
  4. It is my pleasure to help you Pls avoid Siring me I ama student just like you

    We are all are here to help you and learn from you
    • Like Like x 1
  5. Ashish Saklani

    Ashish Saklani Certified CEan

    thank u simplycoder this tutorials will help me in programming.
  6. Its glad to hear.
  7. lit-857

    lit-857 Apprentice

    sir u should give the ans of exersies
  8. The best part about programming is that you know the correct answer.
    If you follow the tutorial throughout then I think you wouldn't find it difficult(challenging has a different meaning.)

    Still if you don't get the output, show your work and then we can debug it or see where it goes wrong.

    Tip:The best way to solve is to execute it by hand for small input.
  9. lit-857

    lit-857 Apprentice

    what d/f b/w float and double datatype
  10. float datatype allows only 4 bytes of memory Whereas the double type allows 8 bytes

    Only the range of these two differs not their other types
  11. lit-857

    lit-857 Apprentice

    i know very well but i want to get understend with exmple
  12. Ganesh MSD

    Ganesh MSD Apprentice

    Nice article...!! This is simply awesome. So useful.
  13. As already stated before, the main difference lies in the range. Float is single precision and double is double precision floating number. It is called double precision as it is twice of a normal float variable.

    As per your request here is an example:

    Suppose ABC person is very rich and has a huge amount of money (so much that it cant be represented in a single precision number). If you want to store that amount of money in a float variable, then it will truncate the double precision number to single precision which in turn will reduce the amount of money that the person holds. Isn't it a problem? Yes it is. That is the main reason for existence of double precision data types i.e. to store huge values.

    The example that I gave is quite vague but I think it will help you in understanding the difference clearly..
    • Like Like x 2
  14. try coding this!!! A good question!

    Write a C program to Remove even numbers and fill it with zeros.
    Note: You can use only one loop for your logic.
    Two variables apart from the array.
    Input array 1,2,3,4,5,6
    Output 1,3,5,0,0,0

  15. no one is answering to this?

  16. I didnt read this. I will post my code soon enough. Give me some time to code. By the way, you want the complete code or just function?
  17. Here is my code. :D Its quite tricky to get the output as you wanted. Odds first then 0's :p Anyways it was good exercise with C++ for me.

    void main()
        int input[6],output[6],i,j=0;
        cout<<"\n Enter the Inputs :";
        while (j>=0)
            if( input[i] % 2 != 0)
            output[j] = input[i];
            j++;                                                              }
        cout<<"\n The output is: ";
          cout<<" "<<output[j];
  18. Was I not clear??? read the question! just 1 loop and 2 variables apart from array!

  19. Meh, Put the for loop outside while, inside. It will work that way too. And if you are using 2 arrays, you have to use two loops atleast.

    If you want ONE loop then the output you will get will be 103050 and not 135000
    • Disagree Disagree x 1
  20. hahahahahahha... :D
    that's the challenge bro don't tell me that it cant be done. It can be done! try!
    one loop.. one array.. 2 supporting variables

Share This Page