Here’s an interesting mind twister: A chocolate costs 1 rupee each. You can also exchange 3 wrappers for a chocolate. If you have 15 rs, how many chocolates can you get?? I posted the question on my facebook wall and instantly started getting lots of answers from friends. To my surprise many of them got … Continue reading
#include<stdio.h> #include<conio.h> main() { int i,n; char a[100]; printf(“\nEnter string\n” ); for(i=0;( ( n=(int)getche() )!=13);i++) { if(n==8){ a[i]=’\\’,a[++i]=’b’;} else if(n==9){ a[i]=’\\’,a[++i]=’t’;} else if(n==92) {a[i]=’\\’,a[++i]=’\\’;} else { a[i]=char(n);} } a[i]=”; printf(“\n\n”); printf(“%s”,a); getch(); }