1. Write a c program to reverse any number.
2. Write a c program to find out sum of digit of given number.
2. Write a c program to find out sum of digit of given number.
10. Write a c program to find out NCR factor of given number.
11. How to convert string to int without using library functions in c
12. Program in c to print 1 to 100 without using loop
13. C program for swapping of two numbers
14. Program to find largest of n numbers in c
15. Split number into digits in c programming
16. C program to count number of digits in a number
11. How to convert string to int without using library functions in c
12. Program in c to print 1 to 100 without using loop
13. C program for swapping of two numbers
14. Program to find largest of n numbers in c
15. Split number into digits in c programming
16. C program to count number of digits in a number
62 comments:
sir (~) tiled use karne se two number add kyun hue...kya aap xplain kr sakte h...
@mohit
a+b=a-(-b)
but we know -b=(~b+1)
so
a+b=a - (~b+1)
a+b= a - ~b - 1
I m just getting crazy in making c problems and i have completed all my assignments and problems that i had in handouts or pdf's and now i got this site as a helping tool to improve my skill to professional level..... Thankx man.. for giving us problems.... :) mean c problems.... ;)
here is a simple logic...adding a and b..say a=5 b=4 so a+b=5+4=9
int main(void)
{
int a=5,b=4;// you can input those nos from user...
while(b)
{
a++;
b--;
}
printf("%d",a);
}
still not clear with '~'...
~b = -(b+1)
so a-(~b)-1 = a-(-(b+1))-1
= a+b+1-1
= a+b
'~' is a type of bitwise operator.
This simply means one's complement.
Bitwise operators can only be operated upon ints & chars.
On taking the one's complement of a number, all the 1's are changed to 0's and vice-versa.
e.g: one's complement of 5 (0101) is -6 (1010).
This code doesn't use any arithmetic operators to add two numbers.
main()
{
int num1, num2;
scanf("%d %d",num1, num2);
printf("%d", Add(num1, num2));
}
int Add(int x, int y)
{
if (y == 0)
return x;
else
return Add( x ^ y, (x & y) << 1);
}
please write explanation also. . .
while (num2) // do until carry
{
int carry = num1 & num2 // if its 1 & 1 we get carry
num1 = num1 ^ num2; // add all 0 +1 = 1
num2 = carry << 1; // now we need to carry
}
return num1
while (num2) // do until carry
{
int carry = num1 & num2 // if its 1 & 1 we get carry
num1 = num1 ^ num2; // add all 0 +1 = 1
num2 = carry << 1; // now we need to carry
}
return num1
while (num2) // do until carry
{
int carry = num1 & num2 // if its 1 & 1 we get carry
num1 = num1 ^ num2; // add all 0 +1 = 1
num2 = carry << 1; // now we need to carry
}
return num1
BH JUYHC
i cant understand
plz also share the problem for multiplication with out using * operator!!!
Here is a slight modification that adds subtraction feature as well:
/* Adds two signed integers. Does a subtract when cin = 1 */
int adder(int a, int b, int cin)
{
if (cin) b = ~b;
int carry = (a & b) << 1 | cin;
a ^= b;
b = carry;
while (b) {
carry = (a & b) << 1;
a ^= b;
b = carry;
}
return a;
}
you can as well use ^ operator.
a^b will give you its sum.
Good thing boss
void main()
{
int a=10,b=10,c;
clrscr();
c=a- -b;
printf("%d",c);
}
You have used "+" operator (A++ which is A = A + 1) which is forbidden in the question itself.
The mission of NCITSolutions is to provide viable, low cost outsourcing solutions. We offer you offshore services tailor made to suit your distinctive requirements. Our low cost IT solutions afford you a competitive edge while delivering tangible results. With a software team whose core competencies range from software design to graphic design, we are equipped to process all your IT needs as we operate on a vast gamut of systems such as: Linux, UNIX, Windows, iOS and Android.
NCITSolutions is an independent and unique organization that was created with the objective of facilitating offshore/outsourcing services to enable clients to benefit from potential business opportunities made available through the creation of free and fair markets in the Middle East region.
We offer:
• Individual outsourcing facilities uniquely tailored for each customer.
• Identification of available market resources and potential partners
• On-the-ground management and support in Jordan
• Legal, technical and cultural support for ventures.
Numerous global companies have set up offices in Amman- Jordan in a bid to promote partnerships and joint ventures with Middle East companies. NCITSolutions maintains a physical presence with staff on the ground in Amman- Jordan. We can also provide businesses with space and easy access to our business support services through our affiliate in Amman Jordan.
Visit us at ncitsolutions.com or contact us at 919-324-6505
The mission of NCITSolutions is to provide viable, low cost outsourcing solutions. We offer you offshore services tailor made to suit your distinctive requirements. Our low cost IT solutions afford you a competitive edge while delivering tangible results. With a software team whose core competencies range from software design to graphic design, we are equipped to process all your IT needs as we operate on a vast gamut of systems such as: Linux, UNIX, Windows, iOS and Android.
NCITSolutions is an independent and unique organization that was created with the objective of facilitating offshore/outsourcing services to enable clients to benefit from potential business opportunities made available through the creation of free and fair markets in the Middle East region.
We offer:
• Individual outsourcing facilities uniquely tailored for each customer.
• Identification of available market resources and potential partners
• On-the-ground management and support in Jordan
• Legal, technical and cultural support for ventures.
Numerous global companies have set up offices in Amman- Jordan in a bid to promote partnerships and joint ventures with Middle East companies. NCITSolutions maintains a physical presence with staff on the ground in Amman- Jordan. We can also provide businesses with space and easy access to our business support services through our affiliate in Amman Jordan.
Visit us at ncitsolutions.com or contact us at 919-324-6505
Simply we can do it as:
#include
int main(){
int a,b;
printf("Enter any two integers: ");
scanf("%d%d",&a,&b);
for(int i=0;i<b;i++)
{
a++;
}
printf("Sum of two integers: %d",a);
return 0;
}
+ is different and ++ is different... question says without using addition operator.. ++ is not addition operator. so the solution is correct. :)
~b = -(b + 1 )
This is the right ones complement .
The blog you shared is very good. I expect more information from you like this blog. Thankyou.
Web Designing Course in chennai
Web Designing Course in bangalore
web designing course in coimbatore
web designing training in bangalore
web designing course in madurai
Web Development courses in bangalore
Web development training in bangalore
Salesforce training in bangalore
Web Designing Course in bangalore with placement
web designing training institute in chennai
I really enjoy simply reading all of your weblogs. Simply wanted to inform you that you have people like me who appreciate your work. Definitely a great post. Hats off to you! The information that you have provided is very helpful.
artificial intelligence in malaysia
Nice Blog. Keep update more information about this..
IELTS Coaching in Chennai
IELTS coaching in bangalore
IELTS coaching centre in coimbatore
IELTS coaching in madurai
IELTS Coaching in Hyderabad
Best ielts coaching in bangalore
ielts training in bangalore
ielts coaching centre in bangalore
ielts classes in bangalore
ethical hacking course in bangalore
Excellent Post, Interesting Article.Indias Fastest Local Search Engine
Salesforce Training | Online Course | Certification in chennai | Salesforce Training | Online Course | Certification in bangalore | Salesforce Training | Online Course | Certification in hyderabad | Salesforce Training | Online Course | Certification in pune
Thanks for your efforts in sharing the knowledge to needed ones. Waiting for more updates. Keep continuing.
Salesforce Training | Online Course | Certification in chennai | Salesforce Training | Online Course | Certification in bangalore | Salesforce Training | Online Course | Certification in hyderabad | Salesforce Training | Online Course | Certification in pune
plz also share the problem for multiplication with out using * operator!!! it may help us a lot thank u guys.
Ai & Artificial Intelligence Course in Chennai
PHP Training in Chennai
Ethical Hacking Course in Chennai Blue Prism Training in Chennai
UiPath Training in Chennai
Nice post. Thanks for sharing! I want people to know just how good this information is in your blog. It’s interesting content and Great work. eave some more info
Ai & Artificial Intelligence Course in Chennai
PHP Training in Chennai
Ethical Hacking Course in Chennai Blue Prism Training in Chennai
UiPath Training in Chennai
Awesome post. I am a normal visitor of your blog and appreciate you taking the time to maintain the excellent site. I’ll be a frequent visitor for a long time.
German Classes in Chennai | Certification | Language Learning Online Courses | GRE Coaching Classes in Chennai | Certification | Language Learning Online Courses | TOEFL Coaching in Chennai | Certification | Language Learning Online Courses | Spoken English Classes in Chennai | Certification | Communication Skills Training
Wow! Such an amazing and helpful post this is. I really really love it. I hope that you continue to do your work like this in the future also.
Ethical Hacking Training in Bangalore
Ethical Hacking Training
I appreciate that you produced this wonderful article to help us get more knowledge about this topic.
I know, it is not an easy task to write such a big article in one day, I've tried that and I've failed. But, here you are, trying the big task and finishing it off and getting good comments.
IELTS Coaching in chennai
German Classes in Chennai
GRE Coaching Classes in Chennai
TOEFL Coaching in Chennai
spoken english classes in chennai | Communication training
astrologers in india
astrology online
best astrologer in andhra pradesh
best astrology online
astrology
famous astrologer in andhra pradesh
best astrologer near me
top 10 astrologers in andhra pradesh
I am here for the first time. I found this table and found it really useful and it helped me a lot. I hope to present something again and help others as you have helped me.
360DigiTMG Data Science Certification
Great article with excellent information thank you.
Data Analytics Course Online 360DigiTMG
This blog was really good formatting, thanks for sharing with us. Visit Ogen Infosystem for professional website designing and digital marketing services at good price.
Website Designing Company in Delhi
I usually buy youtube views for my youtube video from this site https://soclikes.com/. Maybe you will do the same?
If you start youtube blog, I advise you to buy youtube subscribers from this site https://viplikes.in
Such a great and unique information, really glad to learn something new from you. Good job and keep it up.
website development packages
SMM service
web development packages
1000 free youtube subscribers
Digital Marketing Services in delhi
Aivivu - chuyên vé máy bay, tham khảo
vé máy bay đi Mỹ khứ hồi
vé máy bay tết 2021 pacific airlines
giá vé máy bay đi toronto Canada
săn vé máy bay đi Pháp
ve may bay di Anh
cách săn vé máy bay giá rẻ
combo đi đà lạt
combo nha trang tháng 8
Pleasant article, I acknowledged examining your post, fair offer, I need to joke this to my disciples. Much valued!.
AI Course
Really, this article is truly one of the best in the article history. I am a collector of old "items" and sometimes read new items if I find them interesting. And this one that I found quite fascinating and should be part of my collection. Very good work!
Business Analytics Course
Aivivu chuyên vé máy bay, tham khảo
vé máy bay đi Mỹ giá rẻ
vé từ mỹ về việt nam
vé máy bay 2 chiều hà nội đà nẵng
giá vé máy bay hà nội đà lạt khứ hồi
giá vé máy bay sài gòn phú quốc
This is a fantastic website , thanks for sharing.
artificial intelligence course in pune
Thanks For Your Post, Are You Interested to learn digital marketing training for free, here is a source for you.
digital marketing training institute
digital marketing course Training in madhapur
digital marketing Training near me
digital marketing training in vijaywada
digital marketing training in hyderabad
Thanks for sharing this blog. I really appreciate your work on this blog.
Artificial Intelligence Course
Data Science Training
Really nice and interesting post. I was looking for this kind of information, enjoyed reading this one thank you.
Artificial Intelligence Companies in Bangalore
As I am looking at your writing, 온카지노 I regret being unable to do outdoor activities due to Corona 19, and I miss my old daily life. If you also miss the daily life of those days, would you please visit my site once? My site is a site where I post about photos and daily life when I was free.
One of the primary keys to web design for eCommerce is usability. An eCommerce website design company in Delhi must allow simple and practical navigation to its users both in PC and mobile versions.
Website Development Company In Dubai
Website Development Company In Australia
It was really awesome and I gain more information from your post. Thank you!
Fairfax Divorce Lawyers
Excellent blog!!! I really enjoy to read your post and thanks for sharing!
Online Solicitation Of A Minor
Abogado De Divorcio En Virginia
Are you looking for a great way to Learn To Sing For Beginners in sydney, Australia? We offer affordable singing lessons for beginners that will help you develop your vocal skills and confidence. Contact us today to book your first lesson!
Are you looking for a Search Property Buyers Agent in Brisbane, Australia? Asset Plus Buyers Agents can help you find the perfect property. We have many listings, from houses to apartments and flats. We can also help you find the right financing and mortgage options. Contact us today to learn more!
Are you looking for a great way to keep your home cool in the summer and warm in the winter? Outdoor Roller Blinds in Melbourne, Australia are a great solution! Divine Interiors offers a wide selection of high-quality roller blinds that are perfect for any home in Melbourne.
This post is so helpfull and attractive.keep updating with more information. Ziyyara Edutech’s comprehensive online AS Level courses. Designed specifically for AS Level students.
Book A Free Demo Today visit online AS level course
your article is greatfull and thanks for sharing this article in my family. your article is very happy more aticle is share.Operation Valentine Movie (2024)
Nice post. Thanks for sharing. Best Digital Marketing Institute in Bangalore
Nice Blog. Keep update more information about this.
java-full-stack-developer-training-in-hyderabad
Post a Comment