ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
info       Did you received any Funny E-Mails from your Friends and like to share with rest of our friends? Yeah!! you can post that stuff   HERE
Google
 
Categories  >>  Software  >>  Programming Languages  >>  C
 
 


 

 
 C interview questions  C Interview Questions
 C++ interview questions  C++ Interview Questions
 VC++ interview questions  VC++ Interview Questions
 Delphi interview questions  Delphi Interview Questions
 Programming Languages AllOther interview questions  Programming Languages AllOther Interview Questions
Question
Why doesn't the code "int a = 1000, b = 1000;
long int c = a * b;" work?
 Question Submitted By :: Guest
I also faced this Question!!     Rank Answer Posted By  
 
  Re: Why doesn't the code "int a = 1000, b = 1000; long int c = a * b;" work?
Answer
# 1
You must manually cast one of the operands to (long).
 
Is This Answer Correct ?    0 Yes 0 No
Guest
 
  Re: Why doesn't the code "int a = 1000, b = 1000; long int c = a * b;" work?
Answer
# 2
I think mostly we should avoid assigning the variables while
declaring with the variables of another datatype..
 
Is This Answer Correct ?    0 Yes 1 No
Vikraman85
[Anna University!]
 
 
 
  Re: Why doesn't the code "int a = 1000, b = 1000; long int c = a * b;" work?
Answer
# 3
i think, the result exceeds the long int value..

the result is 10 and 6 0s..

and it exceeds the value for the long in

long int is 4 bytes..
the highest value is 65524 (m not very sure.. this could be 
one of the reasons)..
 
Is This Answer Correct ?    0 Yes 1 No
Shruti
 
  Re: Why doesn't the code "int a = 1000, b = 1000; long int c = a * b;" work?
Answer
# 4
this will work.... correctly
 
Is This Answer Correct ?    0 Yes 0 No
Vignesh1988i
 
  Re: Why doesn't the code "int a = 1000, b = 1000; long int c = a * b;" work?
Answer
# 5
This won't work if int is a 16-bit size because 1000000 > 
32767 (2 to the 15th - 1).  It will work when int is a 32-
bit number.  It will work if you cast a or b to a long.
 
Is This Answer Correct ?    1 Yes 0 No
Larry
 
  Re: Why doesn't the code "int a = 1000, b = 1000; long int c = a * b;" work?
Answer
# 6
Integer range exceeds if multiply both the variables the resultant value does not to store it. Due to exceeding the int range only we have to declare it as long int and the value is store in c
 
Is This Answer Correct ?    0 Yes 0 No
Thirupathi Reddy Katkoori
 

 
 
 
Other C Interview Questions
 
  Question Asked @ Answers
 
what is meant by c  4
what is the output of below pgm? void main() { int i=0; if(i) printf("pass"); else printf("fail"); }  3
how to display 2-D array elements in spiral  1
what is the use of call back function in c?tell me with example  1
Program to find the absolute value of given integer using Conditional Operators N-Tech2
number 2 plssssss help !!....using array.. turbo c.. create a program that will accept a number and determine if it is a happy number or an unhappy number.. example: enter a number : 7 7*7=49 then 4 and 9 4*4 and 9*9== 16 + 18 gives you 97 then 9 and 7 9*9 and 7*7 == 81 + 49 gives you 130 then 1 and 3 1*1 and 3*3 == 1 + 9 gives you 10 1*1 gives you 1 sample output: 7= 49= 16+81= 97= 81+49=130 =1+9=10 =1 "7 is a happy number" . if the last number is 2 then the number being inputed is not a happy number.  2
proc() { static i=10; printf("%d",i); } If this proc() is called second time, what is the output? Hughes5
When is an interface "good"?  1
n=7623 { temp=n/10; result=temp*10+ result; n=n/10 } Wipro4
I have an array of 100 elements. Each element contains some text. i want to: append a star character to the end of every fifth element remove every second character from every tenth element, and… add a line feed (ascii 10) after the 30th character of every array element whose length is greater than 30 characters.  1
please give me answer with details #include<stdio.h> main() { int i=1; i=(++i)*(++i)*(++i); printf("%d",i); getch(); }  3
what information does the header files contain? BSNL5
Write a program which take a integer from user and tell whether the given variable is squar of some number or not. eg: is this number is 1,4,9,16... or not Alcatel8
write a C code to reverse a string using a recursive function, without swapping or using an extra memory. Motorola2
which type of question asked from c / c++ in interview.  2
Is the C language is the portable language...If yes...Then Why...and if not then what is problem so it is not a Portable language..??? TCS1
main() { printf("\n %d %d %d",sizeof('3'),sizeof("3"),sizeof(3)); } wat is the o/p and how?  7
program for validity of triangle from 3 side  6
Can u return two values using return keyword? If yes, how? If no, why?  7
What are the languages are portable and platform independent?Why they are like that? Excel1
 
For more C Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com