C

Tuesday, 29 August 2017

C Program To Find Sum of First 10 Natural Numbers Using Do-While Loop.

#include<stdio.h>
main()
{
int num=1, sum=0;
clrscr();
do
{
sum +=num;
num +=1;
}while(num<=10);
printf("The total of first 10 natural numbers is: %d",sum);
getch();
}


No comments:

Post a Comment

Write a program to draw a circle using mid-point circle drawing algorithm.

#include<iostream.h> #include<graphics.h> #include<conio.h> void drawcircle(int x0, int y0, int r) {         ...