ALGORİTMA VE PROGRAMLAMA

 https://www.w3schools.com/c/c_conditions.php

C Eğzersizleri:

DEV C++

!Türkçe karakter kullanma


1)Dikdörtgenin uzunluğu ve genişliğini kullanıcı girsin program ise çevreyi hesaplasın.

2) iki açıyı kullanıcı girsin 3.açıyı program bulsun


// 1'den n'ne kadar olan çift doğal sayıların toplamı
#include <stdio.h>
#include <locale.h>
int main()
{
setlocale(LC_ALL, "Turkish");
int i,n,sum=0;
printf("üst sınırı giriniz:");
scanf("%d",&n);
for(i=2 ; i<=n; i+=2)
{
    sum+=i;
}
printf("%d'ya kadar olan çift doğal sayıların toplamı %d'dir.", n,sum);
return 0;
}

/** * C program to print the sum of all odd numbers from 1 to n */ #include <stdio.h> int main() { int i, n, sum=0; /* Input range to find sum of odd numbers */ printf("Enter upper limit: "); scanf("%d", &n); /* Find the sum of all odd number */ for(i=1; i<=n; i+=2) { sum += i; } printf("Sum of odd numbers = %d", sum); return 0; }
//Çarpım tablosu #include <stdio.h> #include <locale.h> int main() { setlocale(LC_ALL, "Turkish"); int i,n,sum=0; printf("üst sınırı giriniz:"); scanf("%d",&n); for(i=1 ; i<=n; i++) printf("\n%d*%d=%d",i,n,(i*n)); return 0; } -----------
/**
 * C program to print multiplication table of a number
 */


#include <stdio.h> int main() { int i, num; /* Input a number to print table */ printf("Enter number to print table: "); scanf("%d", &num); for(i=1; i<=10; i++) { printf("%d * %d = %d\n", num, i, (num*i)); } return 0; }

Output

Enter number to print table of: 5
5 * 1 = 5
5 * 2 = 10
5 * 3 = 15
5 * 4 = 20
5 * 5 = 25
5 * 6 = 30
5 * 7 = 35
5 * 8 = 40
5 * 9 = 45
5 * 10 = 50





Yorumlar

Bu blogdaki popüler yayınlar

İNSANA İLİŞKİN BAKIŞ AÇILARI VE SINIF YÖNETİMİ

Eğitimde Ahlak ve Etik ders notları