/*PROGRAM BY LAXMAN POUDEL*/C PROGRAM TO PRINT NUMBERS 1 TO N WITHOUT USING LOOPS
WAP program in c to print all numbers from 1 to N numbers using looping.#include<stdio.h> void print_numbers(int,int); //declaring function definition main() { int n; printf("\n *** PROGRAMMING SEEKERS BLOG ***"); printf("\n >>> Program to print numbers 1 to n without using Loops <<<"); printf("\n\n Enter the value of n: "); scanf("%d",&n); //taking value of n as input from user print_numbers(1,n); //calling the function getch(); } void print_numbers(int i,int max) { printf("%3d\t",i); if(i<max) {//calling function recursively print_numbers(++i,max); } return; }OUTPUT OF THE PORGRAM
Friday, February 3, 2017
Labels:
cprogramming
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment