Category: ACM

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”);…

11
Apr
2017

Find maximum and minimum value in an array

for maximum: #include<stdio.h> int main() { int ary[7]={-99,45,100,37,89,-327,245}; int i,max=0; for(i=0;i<7;i++) { if(ary[i]>max) { max=ary[i]; } }…

08
Apr
2017

Continue and Break

code 1: #include<stdio.h> int main(){ int i; for(i=10;i<20;i++) { if(i%2==0) continue; if(i>16) break; printf(“%d\n”,i); } return 0;…

07
Apr
2017

Pattern Printing

Problem: **** *** ** * code: #include<stdio.h> int main() { int i,j; for(i=1; i<=4; i++) { for(j=i;…