Category: A ll Codes

08
May
2017

Logical Not Operation

#include<stdio.h> int main(){ int a=100,b=-70,i; i=!(a>b);// when we use !a it is zero as any non zero…

07
May
2017

Typecasting Secret

code: #include<stdio.h> int main() { int a=5,b=2; float r; char ch=5; r=(float)a/b; printf(“%f”,r); return 0; } Typecasting…

07
May
2017

Hackerearth: Find Product

code: #include<stdio.h> #include<math.h> int main() { int n,A[100005],i; long long int answer=1; //it should not be int…

04
May
2017

Algo: Linear Search

code: /* Count Frequency in an Array(Optimized Version) Syed Ahmed Zaki — 2017 */ #include<stdio.h> int linear_search(int…

04
May
2017

Interview: Find Occurances in an Array – Binary Search Application

Some theory: code: /* Count Frequency in an Array Syed Ahmed Zaki — 2017 */ #include<stdio.h> int…

04
May
2017

Algorithm: Binary Search

iterative code: #include<stdio.h> int binarysearch(int A[],int n,int x) { int low=0, high=n-1; while(low<=high) { int mid=(low+high)/2; //eta…