#include<stdio.h>
void
main()
{
int
i, n, sum=0;
clrscr();
printf("Enter
the value of n:");
scanf("%d",
&n);
for(i=1;
i<=n; i++)
sum=sum+i;
printf("Sum
of first %d natural numbers = %d", n, sum);
getch();
}
This blog consists of C and C++ programs. C and C++ programming is the basics to learn any programming language. Most of the programs are provided with their respective outputs. This blog also contains Data Structures programs using Object-Oriented Programming (C++). Some of the best books for learning C and C++ programming are also mentioned.
ReplyDeletenice article for beginners.thank you.
javacodegeeks
welookups