Skip to content

Instantly share code, notes, and snippets.

@gokhanyavas
Created March 28, 2013 21:33
Show Gist options
  • Save gokhanyavas/5266999 to your computer and use it in GitHub Desktop.
Save gokhanyavas/5266999 to your computer and use it in GitHub Desktop.
Dışarıdan girilen bir n tam sayısına kadar olan tek tam sayiların toplamını bulan c programı.
// Dışarıdan girilen bir n tam sayısına kadar olan tek tam sayiların toplamını
// bulan program.
#include <stdio.h>
#include <conio.h>
int main()
{
int i,n,sonuc;
printf("N sayisini giriniz :");
scanf("%d", &n);
sonuc = 0;
i = 1;
while (i<=n)
{
sonuc = sonuc+i;
i=i+2;
}
printf ("%d e kadar olan sayilarin toplami : %d" ,n,sonuc );
getch();
// ekranın kapanmasını engelliyor..
}
@officialerto
Copy link

Thanks

@bakicpp
Copy link

bakicpp commented Nov 18, 2021

harika!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment