C PROGRAM TO PRINT NUMBERS 1 TO N WITHOUT USING LOOPS
#include<stdio.h> void print_numbers(int,int); //declaring function definition main() { int n; printf("\n *** C PROGRAMS 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; }
Sample Output :
Good
ReplyDeleteHere is a link for C/C++ programs and pointer programs. This may be useful for you.
C/C++ Programs
BA/BCOM/BSC/BBM/COMPUTER/IT/DIPLOMA RESUMES
ReplyDeletehttp://topjobssearchblog.blogspot.in/
Computaholics Provide Programming Example of C,Java program,Opengl program,Hadoop fs commands & Tutorial,Cse Engineering project
ReplyDeletehttp://www.computaholics.in/
http://www.computaholics.in/2015/12/hdfs.html
http://www.computaholics.in/2015/12/mapreduce.html
http://www.computaholics.in/2015/11/hadoop-fs-commands.html
http://www.computaholics.in/2016/01/internet-of-things.html
Thanks for sharing ur valuable inforamtion ,we also provide C programming languages classes in bangalore,visit : <a href="http://www.aptechyelahanka.com/c-courses-bangalore/>Aptech computer education</a>,my tage are : C training bangalore,C courses bangalore,C classes bangalore,C institute bangalore,C coaching centers bangalore,C programming institute in bangalore,C programming classes in bangalore
ReplyDeleteThis blog awesome and i learn a lot about programming from here.The best thing about this blog is that you doing from beginning to experts level.
ReplyDeleteLove from
thanks for this post its really help me in coding by the way did you know what are the datatypes in c programming language
ReplyDeleteThank you for sharing very informatics and useful post about very useful info.... Turbo-IVP (Invoice Validation Portal) and Turbo eSigner
ReplyDelete
ReplyDeleteMovers and Packers in Hyderabad
Movers and Packers in Bangalore
Movers and Packers in Pune
Thanks for sharing nice information. I am really looking for these kind of blog. Keep sharing. c programming classes in pune
ReplyDeletelearn c programming free tutrioal the link is: beginerinprogramming.blogspot.com
ReplyDelete#include
ReplyDeletevoid sum(int,int); /*declaring prototype of function*/
void main()
{
int a,b,c;
printf("\n Enter the two numbers : ");
scanf("%d %d",&a,&b); /* taking two numbers as input*/
c = sum(a,b); /* calling function,
*the value returned by the function is stored in c */
printf("The sum of two numbers is : %d",c);
getch();
}
void sum ( int num1,int num2)
{
int result; /* defining variable, its scope lies within function */
result = num1 + num2 ; /*adding two numbers*/
printf ("sum=%d",result);
}
what is error in this program. i want to add 2 number using calling funtion with no return.
Hi,
Deletec = sum(a,b); this line is wrong, you sum function is not returning anything, then you cannot store any value in c varialble
Nice Blog !
ReplyDeleteComputer Science
ReplyDeletevery useful info, and please keep updating........
Best Online Software Training
good logic and help me a lot in logic building.even we can do the same program with the help of recursion. http://onlinedigitaltechnology.com/control-structure/
ReplyDelete
ReplyDeletevery good information provided you can read the best c Language Interview Questions
This comment has been removed by the author.
ReplyDeleteThank for your kind Information, keep posting and do post something about Embedded System Programming also.
ReplyDeleteThank for your kind Information, keep posting and do post something about Embedded System Programming also.
ReplyDeleteMadaalarqam we provide best electronic trade platforms for consumer and reseller. We also develop all types of Programming applications
ReplyDeleteThanks for splitting your comprehension with us. It’s really useful to me & I hope it helps the people who in need of this vital informationC Programming Training in Chennai
ReplyDeletevery nice..post.
ReplyDeletehttps://shayarihindishayari.com/
Very nice information. I would like to appreciate you. Keep it up!
ReplyDeleteBest Data Science Online Training Institute In Hyderabad | Online Data Science Training
Data Science Online Training Institute In Hyderabad
Data science online training in hyderabad
Best data science training in hyderabad
Best selenium online training institute `
ReplyDeletehi, nice information is given in this blog. Thanks for sharing this type of information, it is so useful for me. nice work keep it up. best sap simple finance online training institute in hyderabad
ReplyDeletethank you for sharing useful info
ReplyDeleteweb programming tutorial
welookups