Write a program to exchange two variaables without temp

Answer Posted / srinivas

main()
{
int a=3,b=2;

a = (a+b)-(b=a);

printf("a=%d,b=%d",a,b);
}
o/p:- a=2,b=3

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the auto keyword good for?

616


How can I display a percentage-done indication that updates itself in place, or show one of those twirling baton progress indicators?

573


How can a program be made to print the line number where an error occurs?

644


What does 1f stand for?

604


Write a program to maintain student’s record. Record should not be available to any unauthorized user. There are three (3) categories of users. Each user has its own type. It depends upon user’s type that which kind of operations user can perform. Their types and options are mentioned below: 1. Admin (Search Record [by Reg. No or Name], View All Records, Insert New Record, Modify Existing Record) 2. Super Admin (Search Record [by Reg. No or Name], View All Records, Insert New Record, Modify Existing Record, Delete Single Record) 3. Guest (Search Record [by Reg. No or Name], View All Records) When first time program runs, it asks to create accounts. Each user type has only 1 account (which means that there can be maximum 3 accounts). In account creation, following options are required: Login Name: <6-10 alphabets long, should be unique> Password: <6-10 alphabets long, should not display characters when user type> Confirm Password: Account Type: Login Name, Password and Account Type should be stored in a separate file in encrypted form. (Encryption means that actual information should be changed and Decryption means that Encrypted information is changed back to the actual information) If any of the above mentioned requirement(s) does not meet then point out mistake and ask user to specify information again. When Program is launched with already created accounts, it will ask for user name and password to authenticate. On successful authentication, give options according to the user’s type.

1509






Is it better to use a pointer to navigate an array of values, or is it better to use a subscripted array name?

646


Why C language is a procedural language?

614


What is the use of putchar function?

646


Explain which of the following operators is incorrect and why? ( >=, <=, <>, ==)

600


How can I read/write structures from/to data files?

544


Whats s or c mean?

591


What is an auto variable in c?

748


Explain what does the characters 'r' and 'w' mean when writing programs that will make use of files?

749


Is exit(status) truly equivalent to returning the same status from main?

583


What's the best way of making my program efficient?

621