its better if you define a variable "sq" of type long int. Int variables have a range (you can google it).
#include <stdio.h>
main ()
{
int n;
printf("enter a number ");
scanf("%d",&n);
printf("\nthe square of the number is ");
printf("%d\n",n*n);
}
program is right (according to me)..
it works fine for small numbers..
but when we give a big input viz. 100000, the program breaks down.. why?? [12]
-
UP 0 DOWN 0 0 9
9 Answers
I tried to joke with the compiler
I typed
#include <stdio.h>
main ()
{
int n;
scanf("%d",&n);
printf("%d\n",1.0/n);
}
and gave input 0!
it said filename.exe has stopped working! lol! :P
It hanged my lappy by the neck till shut down! [6]
C compilers have no sense of humour! :-/ LOL!
Usually it shows divide error. God knows what happened to your compiler. :P It might not have had breakfast! [3]
May be!!
I have my own set of stories with C compiler!
The best one was when I used it for first time..
I did not know head/tail of C..
I typed "ADD TWO NUMBERS"
it said: "SYNTAX ERROR"
I said "JUST ADD THEM."
it said: "SYNTAX ERROR"
I said "Come on it is just addition!" [3] (I was enjoying it.. dont brand a MAD tag on me)
it said: "SYNTAX ERROR"
I SAID: "WTH ARE YOU TRYING TO IGNORE ME??" (rofl)
it said: "SYNTAX ERROR" [3]
I SAID: "I WONT USE U EVER AGAIN!!!!"
it said: "SYNTAX ERROR"
lol!
I officially brand this compiler humourless!
It is very loving though. Carefully finds out your errors in the program, no matter how many times you make it. :) Though I agree its emotionless. [3] You work in Turbo C++ IDE or some other IDE?
idk .. whatever u r talking about is frence/latin/hebrew to me! :P