If you are not able to print the long int and that's the prob, you can use %ld instead of %d -------------------------------------------------- Rohit Saraf Second Year Undergraduate, Dept. of Computer Science and Engineering IIT Bombay http://www.cse.iitb.ac.in/~rohitfeb14
On Sun, Jun 13, 2010 at 1:49 PM, divya jain <[email protected]>wrote: > its an o/p questn.. > conversion wen ur variable is long..nd u r printing using %f...i dont know > how to perform conversion from float to int long nd vice versa.. > plzzzz help.... > > On 13 June 2010 12:12, Rohit Saraf <[email protected]> wrote: > >> what is this for... >> and which conversion are you talking abt? >> >> -------------------------------------------------- >> Rohit Saraf >> Second Year Undergraduate, >> Dept. of Computer Science and Engineering >> IIT Bombay >> http://www.cse.iitb.ac.in/~rohitfeb14<http://www.cse.iitb.ac.in/%7Erohitfeb14> >> >> >> On Sat, Jun 12, 2010 at 11:20 PM, divya <[email protected]> wrote: >> >>> #include <stdio.h> >>> main() >>> { >>> union { >>> long l_e; >>> float f_e; >>> } u; >>> >>> long l_v; >>> float f_v; >>> l_v = u.l_e = 10; >>> printf("%f ", (float)l_v); >>> printf("%f ", u.f_e); >>> f_v = u.f_e = 3.555; >>> printf("%d ", (long)f_v); >>> printf("%d ", u.l_e); >>> } >>> hw to do the conversion here.. >>> >>> -- >>> You received this message because you are subscribed to the Google Groups >>> "Algorithm Geeks" group. >>> To post to this group, send email to [email protected]. >>> To unsubscribe from this group, send email to >>> [email protected]<algogeeks%[email protected]> >>> . >>> For more options, visit this group at >>> http://groups.google.com/group/algogeeks?hl=en. >>> >>> >> -- >> You received this message because you are subscribed to the Google Groups >> "Algorithm Geeks" group. >> To post to this group, send email to [email protected]. >> To unsubscribe from this group, send email to >> [email protected]<algogeeks%[email protected]> >> . >> For more options, visit this group at >> http://groups.google.com/group/algogeeks?hl=en. >> > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<algogeeks%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
