Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

Tasks

Important

ALL TASKS ARE DONE USING RECURSION !

    • Write a program that prints the first 50 natural numbers.
    • Expected output :
        The natural numbers are: 1 2 3 4 5 6 7 8 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
      
    • Write a program that calculates the sum of numbers from 1 to n.
    • Test Data :
       Input the last number of the range starting from 1 : 5
      
    • Expected output :
       The sum of numbers from 1 to 5 :
       15
      
    • Write a program that prints the Fibonacci Series
    • Test Data :
       Input number of terms for the Series (< 20): 10
      
    • Expected Output :
       The Series are :
       1 1 2 3 5 8 13 21 34 55
      
    • Write a program that prints the array elements
    • Test Data :
       Input the number of elements to be stored in the array : 6
       Input 6 elements in the array :
       element[0] : 2
       element[1] : 4
       element[2] : 6
       element[3] : 8
       element[4] : 10
       element[5] : 12
      
    • Expected Output :
       The elements in the array are : 2 4 6 8 10 12
      
    • Write a program that counts the digits of a given number
    • Test Data :
       Input a number : 50
      
    • Expected Output :
       The number of digits in the number is : 2
      
    • Write a program to find the sum of digits of a number
    • Test Data :
       Input any number to find sum of digits : 25
      
    • Expected Ouput :
       The Sum of digits of 25 = 7
      
    • Write a program to find the GCD of two numbers
    • Test Data :
       Input 1st number : 10
       Input 2nd number : 50
      
    • Expected Ouput :
       The GCD of 10 and 50 is : 10
      
    • Write a program to get the largest element of an array
    • Test Data :
       Input the number of elements to be stored in the array : 5
       Input 5 elements in the array
       element[0] : 5
       element[1] : 10
       element[2] : 15
       element[3] : 20
       element[4] : 25
      
    • Expected Ouput :
       Largest element of an array is : 25
      
    • Write a program to reverse a string
    • Test Data :
       Input any string : w3resource
      
    • Expected Ouput :
       The reversed string is : ecruoser3w
      
    • Write a program to find the Factorial of a number
    • Test Data :
       Input a number : 5
      
    • Expected Ouput :
       The Factorial of 5 is : 120
      
    • Write a program to convert a decimal number to binary
    • Test Data :
       Input any decimal number : 66
      
    • Expected Ouput :
       The Binary value of decimal no. 66 is : 1000010
      
    • Write a program to check if a number is a prime number or not
    • Test Data :
       Input any positive number : 7
      
    • Expected Ouput :
       The number 7 is a prime number.
      
    • Write a program to find the LCM of two numbers
    • Test Data :
      Input 1st number for LCM : 4
      Input 2nd number for LCM : 6
      
    • Expected Output :
       The LCM of 4 and 6 : 12
      
    • Write a program to print even or odd numbers in a given range
    • Test Data :
       Input the range to print starting from 1 : 10
      
    • Expected Output :
       All even numbers from 1 to 10 are : 2 4 6 8 10
       All odd numbers from 1 to 10 are : 1 3 5 7 9