//
archives

programming

This category contains 2 posts

The Chocolate And Wrappers Problem

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 »

C program to replace tab by \t, backspace by \b and \ by \\

#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(); }

My tweets

  • No matter how big or bad you are, when a 3 year old kid fires a gun at you; you pretend to die! 8 hours ago
  • Mixed feelings about the decision to dissolve the CA. Can only do one thing. Hope for the best. #politics #Nepal 8 hours ago

Enter your email address to follow this blog and receive notifications of new posts by email.

Join 453 other followers

Follow

Get every new post delivered to your Inbox.

Join 453 other followers