Category: C

10
May
2017

While Loop Tricks :D

code: #include<stdio.h> int main() { int i=1; while(i<=printf(“Hi\n”)){ printf(“Hello\n”); i++; } printf(“%d\n”,i); return 0; } output: Hi…

10
May
2017

C Different Loop While

code: #include<stdio.h> int main() { int number,sum=0; printf(“Enter a positive number, negative to terminate:”); scanf(“%d”,&number); while(number>=0) {…

09
May
2017

C Conditional Logic

Conditional Question: source: http://101cproblems.com/problem-25/ Problem 25: Coordinate Take two integers indicating the x and y coordinate of…

09
May
2017

Learn Modulo in Easy Way

One thing was confusion for me but after watching this tut it is clear to me now….

09
May
2017

Leap Year Returned :P

code: #include<stdio.h> int main() { int year,x; printf(“Enter year:”); scanf(“%d”,&year); //((year%4==0&&year%100!=0)||(year%400==0))?:printf(“%d is not leap year.”,year); x=((year%4==0&&year%100!=0)||(year%400==0))?1:0; if(x==0)…

09
May
2017

Ternary in C

code: #include<stdio.h> int main() { int a=20,b=50,c=40,m; // if(a>b && a>c) // m=a; // else if(b>c) //…