/*
* 1000+ C programs + tutorials
*
*
* 52_display_1st_10_natural_numbers_and_their_sum.c
*
*
* Created on: Oct 20, 2014
* Author: Code2care.org
*/
#include
//#include <conio.h>
void main() {
// clrscr();
int i;
int sum = 0;
printf("C Program to Display 1st 10 natural numbers and their sum : ");
printf("\n\n 1st 10 natural numbers : ");
for(i = 1 ; i <= 10 ; i++) {
sum = sum + i;
printf("%d ",i);
}
printf("\n\n Sum of 1st 10 natural numbers : %d ",sum);
// getch();
}
-
Output :
C Program to Display 1st 10 natural numbers and their sum :
1st 10 natural numbers : 1 2 3 4 5 6 7 8 9 10
Sum of 1st 10 natural numbers : 55
The best way to learn C programming is to practice more and more of programs .
Code2care C Programming tutorials provide 1000+ programs in C that you can study and become an expert in the language. Programs are divided into categories depending upon type and complexity.
BSc. IT, BSc. Computer Science, BSc. IT, MSc. IT, MSc. Computer Science, MCA, BTech IT & BTech Engineers may find these programs very useful.