Dışardan girilen n sayısına kadar olan sayıların toplamı C Program (The sum of the numbers up to the n number entered C Program)

#include <stdio.h>

#include <conio.h>


int main()

{

  int i,n,result ;

     

   scanf("%d", &n);

   

   result=0;


   for  (i=1; i<=n; i++ )

   

   result = result + i;

   

   printf(" sum : %d ", result  );  

   

   return 0;

   getch();

    

}

Yorumlar