Category: Language

21
Apr
2017

Count number of 2’s in a given range (0 to n)? (ex: range between 0-20, Ans: 3 (i.e [2], 1[2], [2]0))

Google Search: https://www.google.com/search?q=Counting+2s&ie=utf-8&oe=utf-8&client=firefox-b#q=Counting+2s+in+c SOlution: https://www.careercup.com/question?id=56794 //https://www.careercup.com/question?id=56794 #include<stdio.h> int main() { int n,i,j; int ctr=0; scanf(“%d”,&n); for(i=0;i<=n;i++) { for(j=i;j>0;j=j/10) {…

21
Apr
2017

PHP Regex

Regex Tutorial: Best Site To Learn Tutorial https://regexone.com/lesson/optional_characters (Will start from this page other pages completed before)…

20
Apr
2017

Frequency of Digit in A Number

code: //program to cound frequency of digits in a number #include<stdio.h> #define BASE 10 int main() {…

20
Apr
2017

Logic to Find First and Last Digit

Last Digit: #include<stdio.h> int main(){ int num,lastdigit; printf(“enter any number:”); scanf(“%d”,&num); lastdigit=num%10; printf(“lastdigit = %d”,lastdigit); return 0;…

19
Apr
2017

String Frequency Count

code: simple code: #include<stdio.h> int main() { char str[300],ch; int i,frequency=0; printf(“enter string:”); gets(str); printf(“enter character:”); scanf(“%c”,&ch);…

19
Apr
2017

String Palindrome Problem

My Own Logic: #include<stdio.h> int main() { char str[200]; int i,j; gets(str); for(i=0;str[i]!=’\0′;i++); for(j=0;j<i;j++) { if(str[0]==str[i-1]){ printf(“Palindrome\n”);…