Skip to content

Instantly share code, notes, and snippets.

@yusufpapurcu
Created November 2, 2023 22:26
Show Gist options
  • Save yusufpapurcu/54ea09846e6aef6e9282467a2c1abb9f to your computer and use it in GitHub Desktop.
Save yusufpapurcu/54ea09846e6aef6e9282467a2c1abb9f to your computer and use it in GitHub Desktop.
#include <stdio.h>
int getInput(const char *const _Format, ...);
const float midterm_ratio = 0.6;
const float final_ratio = 0.4;
int main()
{
printf("DERS ORTALAMASI HESAPLAMA\n");
printf("-----------------------------------\n");
int students = getInput("OGRENCI SAYISINI GIRINIZ:");
for (size_t current_student = 1; current_student <= students; current_student++)
{
printf("-----------------------------------\n");
int student_no = getInput("%d.OGRENCININ OGRENCI NUMARASINI GIRINIZ:", current_student);
int midterm = getInput("%d NUMARALI OGRENCININ VIZE NOTUNU GIRINIZ:", student_no);
int final = getInput("%d NUMARALI OGRENCININ FINAL NOTUNU GIRINIZ:", student_no);
int ort = final_ratio * final + midterm_ratio * midterm;
printf("-----------------------------------\n");
printf("%d NUMARALI OGRENCININ VIZE NOTU:%d\n", student_no, midterm);
printf("%d NUMARALI OGRENCININ FINAL NOTU:%d\n", student_no, final);
printf("%d NUMARALI OGRENCININ DONEM ORTALAMASI:%d\n", student_no, ort);
current_student++;
}
}
int getInput(const char *const _Format, ...)
{
printf(_Format);
int res;
scanf_s("%d", &res);
return res;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment