This blog is under construction

Monday 8 July 2013

C program to calculate modulus

Write a C program to calculate modulus of a number / two numbers.


  #include <stdio.h>
  int main() {
        int num1, num2;

        /* get the first input from the user */
        printf("Enter the value for first number:");
        scanf("%d", &num1);

        /* find the modulus for num1 */
        printf("|%d| = ", num1);
        if (num1 < 0) {
                num1 = num1 * (-1);
        }
        printf("%d\n", num1);

        printf("Enter the value for second number:");
        scanf("%d", &num2);

        /* find the modulus for num2 */
        printf("|%d| = ", num2);
        if (num2 < 0) {
                num2 = num2 * (-1);
        }
        printf("%d\n", num2);
        /* find num1 modulo num2 */
        printf("%d modulo %d is %d\n", num1, num2, num1 % num2);
        return 0;
  }



  Output:
  jp@jp-VirtualBox:~/$ ./a.out
  Enter the value for first number:-100
  |-100| = 100
  Enter the value for second number:-93
  |-93| = 93
  100 modulo 93 is 7





See Also:

60 comments:

  1. hello these are good programs

    ReplyDelete
  2. The increasing importance of technology in every industry continues to drive the need for a diverse group of qualified professionals to manage the implementation and changes in technology. Pursuing a degree at a technology management graduate school can be the right step for beginning a rewarding career in the management of everything from computer hardware to information security within an organization. Overview of Technology Management Technology management professionals are in high demand because of the unique set of skills they possess. antminer u3 setup guide

    ReplyDelete
  3. Technology is vital to the existence and competitive edge of any company. I believe that's the great understatement of the year. Look at what technology allows us to do as compared to 30 years ago; now think back about five years, we've come a long way. tiger shark pool cleaner

    ReplyDelete
  4. Technology is vital to the existence and competitive edge of any company. I believe that's the great understatement of the year. Look at what technology allows us to do as compared to 30 years ago; now think back about five years, we've come a long way. kg to stone converter

    ReplyDelete
  5. All computer consultants are not created equal. Some specialize in hardware, others in software but what you really need is one that specializes in business and how technology can make it better. You need a business technology coach that can help you work smarter with technology. Durometer

    ReplyDelete
  6. กำจัดปลวกเชียงใหม่ ( chiangmai termite ) เป็นบริษัทกำจัดปลวกเชียงใหม่ ฉีดปลวกเชียงใหม่ราคาถูก เน้นความคุ้มค่า เพื่อลดค่าใช้จ่ายของลูกค้า. มีขั้นตอนการฉีดปลวกเหมือนกับบริษัทใหญ่ราคาแพง. ปลวกเชียงใหม่

    ReplyDelete
  7. The ceiling fan industry has gone though some dramatic changes and still needs to change to keep up with reduced demand and rising costs. Here is a brief history of the ceiling fan story in America and where it may be going. Not just about fans, this article is relevant to the overall small manufacturing business in America. best ceiling fan high speed

    ReplyDelete
  8. What City is this you ask? Houston, and not only is Houston going green, this great city has become a technology mecca with many web hosting firms developing strong relationships in the city. best web hosting reviews 2020

    ReplyDelete
  9. Were already on the modern technology and it's good to have this kind of articles to know more about other things that we could link into it

    ReplyDelete
  10. Tennessee temperature test chamber Center at Nashville is one of the 26 technology centers established in the year 1963. The technology center excels in offering technical training programs in various fields.

    ReplyDelete
  11. Over the years, cooling bulk solids such as sugar, fertilizer, chemicals, plastics, dried biosolids, minerals, and many other types of grains, crystals and bulk powders using the traditional technologies does not guarantee quality final products. As a result, the business productivity was greatly affected and most of all this technology has lots of disadvantages to deal with. Carding Forum

    ReplyDelete
  12. Over the years, cooling bulk solids such as sugar, fertilizer, chemicals, plastics, dried biosolids, minerals, and many other types of grains, crystals and bulk powders using the traditional technologies does not guarantee quality final products. As a result, the business productivity was greatly affected and most of all this technology has lots of disadvantages to deal with. where to buy

    ReplyDelete
  13. Introduction - Imagine an enterprise software development project where the customer says "we are going to take a long time to get this done and we don't expect to see any results for at least two years". Can you imagine it? Me neither, and the truth is that it will probably never happen:) So what is reality? South Melbourne Hypnotherapy

    ReplyDelete
  14. In 1997 Mr. Clayton M.Christensen ( A Harvard Business School Professor ) introduces a new term "Disruptive Technology". He also describes that displaces an established technology. electricians tool belt

    ReplyDelete
  15. Technology-enabled solutions are intangible sales. People don't buy the machine; they buy what it enables. Average sales people tend to perceive technology as a tangible, so they focus on the functionality. Exceptional sales people understand that customers only care about the results the technology enables, which is intangible. This difference in perception about the nature of technology is the fundamental factor in determining a sales person's success. lg v20 wireless charging

    ReplyDelete
  16. Over the years, cooling bulk solids such as sugar, fertilizer, chemicals, plastics, dried biosolids, minerals, and many other types of grains, crystals and bulk powders using the traditional technologies does not guarantee quality final products. As a result, the business productivity was greatly affected and most of all this technology has lots of disadvantages to deal with. Xender For PC

    ReplyDelete
  17. Followpc about technology related best apps for PC windows and Mac and we will guide you to How to use and How to install. our team will instruction to you. How to get rid of split screen on ipad

    ReplyDelete
  18. Over the years, cooling bulk solids such as sugar, fertilizer, chemicals, plastics, dried biosolids, minerals, and many other types of grains, crystals and bulk powders using the traditional technologies does not guarantee quality final products. As a result, the business productivity was greatly affected and most of all this technology has lots of disadvantages to deal with. best supplies

    ReplyDelete
  19. This website is my breathing in, real fantastic design and perfect content . Nicolas Krafft L'Oreal news

    ReplyDelete
  20. This question has been in the minds of most folks. In the midst of the uprising technology advances we are also faced with lots of negative effects we see today. This question is actually related with life and medicine as technology has solved a lot of our health problems in the past that was almost impossible to deal with. Gilbert Masonry

    ReplyDelete
  21. If it behaves like a drug, and possesses the same characteristics of a drug, then it may very well be a... As many of you know, I have discussed the adverse effects of technology on numerous occasions. Specifically, I am talking about such things as mobile phones, video games, tablets and personal computers, those devices we embrace in the daily affairs of our lives. fuel fixer

    ReplyDelete
  22. Pretty section of content. I just stumbled upon your website and in accession capital to assert that I get in fact enjoyed account your blog posts. Any way I’ll be subscribing to your feeds and even I achievement you access consistently fast. https://cheapsoft4you.com/

    ReplyDelete
  23. Pretty section of content. I just stumbled upon your website and in accession capital to assert that I get in fact enjoyed account your blog posts. Any way I’ll be subscribing to your feeds and even I achievement you access consistently fast. 먹튀커뮤니티

    ReplyDelete
  24. An explanation in simple terms of 2G and 3G Technology and what they mean for you in today's world. You will see how 3G Phones offer fantastic features including photo-editing, movie presentations and the World Wide Web. You can keep in touch with your friends with digital photos and other communications. route optimize

    ReplyDelete
  25. Pretty section of content. I just stumbled upon your website and in accession capital to assert that I get in fact enjoyed account your blog posts. Any way I’ll be subscribing to your feeds and even I achievement you access consistently fast. 먹튀사이트

    ReplyDelete
  26. Its like you read my mind! You seem to know so much about this, like you wrote the book in it or something. I think that you can do with a few pics to drive the message home a little bit, but other than that, this is excellent blog. A fantastic read. I will definitely be back. 먹튀사이트

    ReplyDelete
  27. If you are looking for a career that can be both physically and financially rewarding, you may want to consider a position in the construction industry. There are many types of positions in the construction industry. decoracion zaragoza

    ReplyDelete
  28. Now that you have decided to get yourself a mountain bike, the next thing you should know is that there are so many different types of bikes to suit different types of needs. There is no one fits all here. There are at least 5 different types of bikes, and each bike is designed to tackle different types or terrains and obstacles with its own advantages and disadvantages. Before buying your mountain bike, it best to know where you will be riding and what types of obstacles will you encounter on your rides. This will ultimately help you to decide on the best mountain bike for your usage. Best Electric Bikes

    ReplyDelete
  29. Have you ever wondered what attracted you in a new iPad, new smartphone, or any other modern gadget? Was it its fascinating technology or its simplicity of design? Design has become an essential communication tool and it's hard to imaging new technology without it. best Surveillance system cctv

    ReplyDelete
  30. Have you ever wondered what attracted you in a new iPad, new smartphone, or any other modern gadget? Was it its fascinating technology or its simplicity of design? Design has become an essential communication tool and it's hard to imaging new technology without it. cheap access control system

    ReplyDelete
  31. It is no secret that there is a secret behind technology blogging; it is one of the best niches in blogging. Blogging about technology is one of the best ways to get ahead in modern society. In fact, technology blogging is the best niche in blogging these days for anyone who wants to start up a successful business. this is very helpful to buy mitsubishi forklift

    ReplyDelete
  32. I found your website through a random stroke of luck. It helped me do my research on this topic. Its amazing to think one site could contain so muck information. You are doing the great work! live 22

    ReplyDelete
  33. Having the potential to turn the sails in favour of neophytes and bring down incumbents, Digital Disruption is reshaping markets with the speed and force that has no match in history! Survivors are those businesses that are pro-actively adopting digital, but in order to thrive, they must also innovate new business models to keep pace with the digital age! Corporate Investigator Oakville

    ReplyDelete
  34. Technology is generally defined as the practical application of scientific knowledge in the commercial and industrial field. Have you ever tried to imagine how the business world would function without technology? Everybody will agree that technology is indeed essential for all businesses whether they are small or large. Teletalk offer 2021

    ReplyDelete
  35. When it comes to purchasing large machinery, prices can be sky high. However, quality is always something to be considered. Here are a few tips to consider when purchasing larger machinery, especially Sand Mixers. read here

    ReplyDelete
  36. Few people today realize how complex the process of accurate medical billing has become. It is critical that both doctors and those looking for employment as medical billing workers understand the advantages and disadvantages of various types of medical billing software solutions and what sort of training and experience workers in the medical billing industry should have. instagram smm panel

    ReplyDelete
  37. There are so many exercise bikes available that it's easy to be overwhelmed. Spinning bikes, stationary bikes, dual action bikes, and recumbent bikes are probably some of the terms you've heard. It's almost as though you have to be a fitness equipment engineer to understand the differences! Here's a quick summary of these confusing terms. DT240 road wheels R&D

    ReplyDelete
  38. Wow! Thank you! I permanently wanted to write on my site something like that. Can I implement a fragment of your post to my website?
    먹튀검증

    ReplyDelete
  39. The dictionary defines maintenance as, "The work of keeping something in proper order." However, this definition does not necessarily fit for software. Software maintenance is different from hardware maintenance because software doesn't physically wear out, but often gets less useful with age. office 2019 professional plus download

    ReplyDelete
  40. IBM Lotus Domino or Microsoft Exchange? The severe competition continues for many years between two main leaders in collaboration solutions - IBM and Microsoft. Whether the choice of a platform influ... windows 10 pro product key

    ReplyDelete
  41. One of the more in-demand degrees today is in the field of technology and IT, and the variety of college and university programs on the internet have made it easier to earn a technology degree online. In fact, some the institutions are strictly technology oriented schools. You can be certified, or you can go for a bachelor's, masters, or even a doctorate degree in technology online at a variety of online colleges and universities. Beijing Soonercleaning Technology

    ReplyDelete
  42. Have you noted that when you go and read the news online, and read through the various stories from the syndicated websites that they usually have a technology section, and that technology section is filled with the latest gadgets, social networking methods, and any of the newest things coming from Silicon Valley? I have, and as a lover of technology, and coordinator for a think tank, I am disturbed by all this. Now then let me explain what I mean. Beijing Soonercleaning Technology

    ReplyDelete
  43. There are many types of business hosting available. Which is best is likely to come down to a number of issues related to the nature of the business, the purpose of the website, and the likely amount of traffic. https://onohosting.com/

    ReplyDelete
  44. Shopping can be a fun activity for some, but for others it is irritating. For those who find it irritating, online shopping is the best option available. Online shopping can be fun, economical, time-saving and simple. Also, since it provides a controlled environment, the chances of splurging are lower. ScraperAPI.com Coupons

    ReplyDelete
  45. With today's technologies and the increasing demand for a wider variety of services, are Web hosting providers pricing their programs competitively to remain in today's market? Web hosting has advanced into a collection of multifaceted specialized categories from shared hosting to dedicate hosting. Also, hosting has always been driven by a growing customer's demand and advances in the latest technology. Cheap Web Hosting

    ReplyDelete
  46. An agreement between an indemnity company and an insured regarding covering the automobile of the insured is called auto insurance. The role of the owner of the auto mobile is to pay premiums periodically. Dell Computer

    ReplyDelete
  47. If it behaves like a drug, and possesses the same characteristics of a drug, then it may very well be a... As many of you know, I have discussed the adverse effects of technology on numerous occasions. Specifically, I am talking about such things as mobile phones, video games, tablets and personal computers, those devices we embrace in the daily affairs of our lives. energy resources

    ReplyDelete
  48. Chemicals are essential for keeping the backbone of the industrial and agricultural development process in any economy. Chemicals are essential for running industrial operations in multiple ways and therefore the importance of industrial chemical tenders have been growing consistently. Chemicals have multiple uses from agriculture and household articles to weapons and defense oriented products. They are also essential for laboratories and scientific research. Widely used in medicine, agriculture, and cosmetics industries, chemicals are also used by military and scientists for research. However chemical products tenders in such cases may come up with certain restrictions and may not be open to all Order Caluanie

    ReplyDelete
  49. Have you ever wondered what attracted you in a new iPad, new smartphone, or any other modern gadget? Was it its fascinating technology or its simplicity of design? Design has become an essential communication tool and it's hard to imaging new technology without it. Design Thinking

    ReplyDelete
  50. The original triathletes were amazing. Dave Scott and Mark Allen accomplished amazing feats in triathlon long before technology took over the sport. AM.CO.ZA

    ReplyDelete
  51. Learn the truth about paid gamers and how you too can start testing games for cash. You don't have to dream about being paid to play video games, with this information, you can make it a reality! best discord servers

    ReplyDelete
  52. Really I enjoy your site with effective and useful information. It is included very nice post with a lot of our resources. Thanks for share. i enjoy this post. litigation

    ReplyDelete
  53. In 1997 Mr. Clayton M.Christensen ( A Harvard Business School Professor ) introduces a new term "Disruptive Technology". He also describes that displaces an established technology. https://mysmartfaq.com

    ReplyDelete
  54. Schools across the globe are going through a growth spurt of sorts, which is both painful and unavoidable. I'm talking, of course, about technology integration. Maybe your class is using a COW (Computer on Wheels) cart once a week or maybe every student in your school is suddenly holding an iPad and administrators are throwing around the dreaded phrase "going paperless." The site is experiencing technical difficulties

    ReplyDelete
  55. Parents battle with their kids with their use of tablets, mobile phones, TV, and streaming services. How can a parent balance a child's use of technology with education? Houston Pressure Washer

    ReplyDelete
  56. Technology is vital to the existence and competitive edge of any company. I believe that's the great understatement of the year. Look at what technology allows us to do as compared to 30 years ago; now think back about five years, we've come a long way. Forensic Investigations

    ReplyDelete
  57. Have you ever wondered how companies come up with their battery life claims? The number is printed confidently on the product packaging, but where did it really come from? Learn how battery life is calculated and become a more informed, savvy consumer of battery-powered devices. 12V 100Ah LiFePO4

    ReplyDelete
  58. Technology is vital to the existence and competitive edge of any company. I believe that's the great understatement of the year. Look at what technology allows us to do as compared to 30 years ago; now think back about five years, we've come a long way. hydrafacial machine

    ReplyDelete
  59. Customer service is crucial to the success of any business, and Cheapest SMM panel are no exception. To ensure a positive experience for your customers, you must respond to their questions and concerns quickly and effectively.

    ReplyDelete
  60. It's a game-changer for small businesses and individuals looking to maximize their online reach without breaking the bank because this cheap SMM panel not only fits my budget but also provides quality services.

    ReplyDelete