Skip to content

Instantly share code, notes, and snippets.

View anonur's full-sized avatar
🎯
Focusing

Onur Aydoğdu anonur

🎯
Focusing
View GitHub Profile
@anonur
anonur / while-sum.c
Last active April 4, 2019 19:04
Summarize integers while user enters 0
#include<stdio.h>
int main()
{
int ctr = 1;//counter
int sum = 0;//summary
while(ctr != 0) {
printf("Enter an integer: ");
scanf("%d",&ctr);
@anonur
anonur / switch-case.c
Last active April 4, 2019 19:06
Sums integers while user enters 0
#include<stdio.h>
int main()
{
int x;
printf("Enter a one digit integer: ");
scanf("%d",&x);
switch(x)
{
#include<stdio.h>
int main(void)
{
unsigned int passes = 0;
unsigned int failures = 0;
unsigned int student = 1;
int result;
while(student <= 10) {
printf("%s","Enter result (1=pass,2=fail): ");
@anonur
anonur / multiple.c
Last active April 4, 2019 19:09
Decides if the first integer is a multiple of the second
#include<stdio.h>
int main()
{
int x,y;
printf("Enter two integers: ");
scanf("%d %d",&x,&y);
if(x % y == 0) {
printf("First integer is a multiple of the second.\n");
@anonur
anonur / even-odd.c
Last active April 4, 2019 19:11
decides if the given number is even or odd
#include<stdio.h>
int main()
{
int x;
printf("Enter an integer: ");
scanf("%d",&x);
if(x % 2 == 0) {
printf("This number is even.\n");
@anonur
anonur / class-average-while.c
Last active April 4, 2019 19:12
Finds note average of 10 students
#include<stdio.h>
int main(void)
{
unsigned int counter;
int grade;
int total;
int average;
//initialization phase
@anonur
anonur / if-comparison.c
Last active April 4, 2019 19:13
Compare two numbers with if
#include<stdio.h>
int main(void)
{
int num1;
int num2;
printf("Enter two integers, and I will tell you\n");
printf("the relationships they satisfy: ");
@anonur
anonur / sum-integer.c
Last active April 4, 2019 19:14
Finds sum and products of two integers
#include<stdio.h>
int main(void)
{
int integer1;
int integer2;
int sum;
int product;
@anonur
anonur / num-sum-array-first-pointer.c
Last active April 4, 2019 19:14
Finding summary of numbers in an array from first elements pointer
#include<stdio.h>
int array1(int a[],int n)
{
int *p,sum=0,counter;
p=&a[0];
for(counter=0;counter<n;counter++)
sum+=*(p+counter);
return sum;
@anonur
anonur / pointer-arrays.c
Last active April 4, 2019 19:15
Shows addresses of entered numbers
#include<stdio.h>
#include<conio.h>
int main()
{
int val[8] = {25,69,83,23,96,13,41,90};
for(int i = 0; i <= 7; i++)
{
printf("\nval[%d]: value %d and address %p",i,val[i],&val[i]);