Different Programming Concepts – I


Hi Everyone…. In this post lets try few simple logic concepts in Programming

Print 1 to 1000 numbers without using loops

There are many ways for make this logic works. Some of them are

  • Using goto
  • Using Divide and Conquer
  • Using recursion

Goto

Divide and Conquer

Recursion

 

Write a Java Program to reverse both word and sentence without using reverse function

For Example Have to Change Welcome to TechTwinklers as emocleW ot srelkniwThceT

Program

 

Hope This was useful for you. If you have any other logic feel free to share with us using the comments below

 

 

You may also like

2 Comments

  • Kunthavai Devi
    November 3, 2012 at 9:19 AM

    Nice Dr 🙂 Keep it up 🙂

  • Gabi
    December 27, 2012 at 7:47 PM

    Technically, none of the examples here are loop-less.
    The goto example basically achieves a loop. When it gets compiled, the machine code will look exactly as if it was written with for/while/do.
    In the divide and conquer example, the function calls work the same as four nested loops.
    And the recursion example achieves a loop by using recursive calls.

    Function calls an goto/jumps are the same thing when it comes to structural programming: they move the instruction pointer to another location, so technically, they can all be used to create loops.

    So (technically) the only way to really be “loopless” is to just add print instructions for all of the numbers, one after another. 🙂

LEAVE A COMMENT

Welcome To TechTwinklers!

Tech Twinklers is a Tech Blog run by Students with an aspiring enthusiasm in Technology and Gaming. This Blog will bring News about the Modern Technology, Educational Advances, Campus Interviews, etc. So make sure you subscribe to our blog because we don't want you to miss a thing that is posted here..

We're on Facebook!