Look into this code:

#include <stdio.h>
main()
{
int p,n,r;
float si;
scanf("%d %d %d", &p, &n, &r);
si=p*n*r/100;
printf("SI = %f", si);
}

Output of this program is
100
100
100
SI = 169.00000
and also this:

#include <stdio.h>
main( )
{
int p, n ;
float r, si ;
printf ( "Enter values of p, n, r" ) ;
scanf ( "%d %d %f", &p, &n, &r ) ;
si = p * n * r / 100 ;
printf ( "%f" , si ) ;
}

Output of this program is
100
100
100
SI = 1000

How a compiler is understanding these codes?
Why the answer is not correct for the first program?

Can any one help me out with a compiler meaning?

What compiler are you using?

Let's see... I'm going to troll a bit here. From the name Shankar, I'm guessing he's Indian. With that, I'm going to assume that he's using our beloved Turbo C++ in 16 glorious bits. I'm going to further guess that there's an overflow error lurking about here somewhere.

commented: lol :P +0

Try outputting the values you input to see if they are correct.
Since you are probably using, as DeanMSands3 supposes, Turbo (I'm sure he's correct) find out what the largest integer is you can have in your compiler.

Member Avatar for I_m_rude

hey DeanMsands3 , It is not good that how rudely you are talking here. If any body is using Turbo or any thing, then you can't say(insult) that he is indian or american or whatever. It is a very nice forum and very good repo in India also. But, Having this type of mocking at Indians IS REALLY HURTING and can be painful. Any body can use any thing what ever he wants and actually need, So I request you "DON'T GUESS FROM THE COMPILER THAT WHICH NATIONALITY A PERSON HAS".

THANKS.

no nitin1 actually india is really below the curve bcoz in most of the colleges r using turbo c .so surely everyone will make us embrassing

Member Avatar for I_m_rude

@ritish I know this as I hope you also know that I am Indian too. But, the respect for the country is there in us. DeanMsand3 has said that thing in a too insultive way. It is okay if indians use that but ANYONE can't be insultive for that. I hope you are getting what i am trying to say.

yeah he is insulting iam too an indian from chennai.its upto them they may have bad feeling about us.but we cant fight with them

better use code blocks with mingw shankar

So I request you "DON'T GUESS FROM THE COMPILER THAT WHICH NATIONALITY A PERSON HAS".

It looks to me like he guessed India from the OP's name, and then further speculated the compiler based on previous observations (an observation I've made as well). I don't think you should feel insulted, but I'll ask two questions that may calm your anger:

  1. Is Shankar an uncommon name in India or exceptionally common in another country that you would be insulted if it were associated with India?

  2. Is Turbo C not the most commonly used compiler in educational institutions by far in India?

If you answered yes to either of those then you can take offense and address the issue privately with DeanMSands3. Otherwise, I'd suggest growing some thicker skin and not taking offense at the first potentially negative mention of your country. That's how pointless wars are started.

Member Avatar for I_m_rude

@james sir,

This is a very nice thing which you said. I know shankar is a common name and TC is used alot here. But, Sometimes many things hurt you which may look "non-hurting" to anyone else. Okay! you are a great person for me and I request you limitless.
thanks for making me understand. :)

Im Indian too. And yeah turbo C is the most common IDE used here. But lets not takes these seriously guys, we are here to learn and share. So peace guys.
And for shankar, please use MinGW compilers with codeblocks. It will help you a lot. :)

commented: truly you are an indian! :) +0
Member Avatar for I_m_rude

okies. thanks for your suggestions. And shankar you can dev C++ or codeblocks. they are quite good for you.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.