Skip to main content

Making a simple calculater by using c language (coding).


#include<stdio.h>

void main()
{
       float n,a,b;
            printf("enter 1 for addition\n");
            printf("enter 2 for subtraction\n");
            printf("enter 3 for multiplication\n");
            printf("enter 4 for division\n");
            scanf("%d",&n);
          if(n>=1&&n<5)
         {
            printf("enter first number:");
            scanf("%f",&a);
            printf("enter second number:");
            scanf("%f",&b);
              if(n==1)
                  {
                    printf("%f+%f=%f",a,b,a+b);
                   }
             else if(n==2)
                  {
                    printf("%f-%f=%f",a,b,a-b);
                   }
             else if(n==3)
                  {
                    printf("%f*%f=%f",a,b,a*b);
                   }
             else
                  {
                    printf("%f/%f=%f",a,b,a/b);
                   }
          }
         else
         {
           printf("enter  valid number");
         }
 }


   

Popular posts from this blog

Top ten Most Expensive Diamonds in the World for ever in history

Diamonds last forever, diamonds are a girl’s best friend, a diamond in the rough: these sayings all emphasise the beauty and strength of world’s most famous gems. Take a look at the 10 most expensive diamonds in the world in this Catawiki story! 10. The orange - 32 million euros This 14.82-carat bright orange diamond broke a world record when it sold for 32 million euros in 2013. Generally, pink and blue diamonds are the most sought after, but this rare gem surprised the world with its orange beauty and size. 9. The Princie - 33 million euros This pink, 34.54- carat diamond has been known of for 300 years now, after it was discovered in the Golconda mines in India. It was bought from the Hyderabad Royal family in 1960 by jewellers Van Cleef & Arpels, who named it the Princie after the son of Sita Devi, the Maharanee of Baroda, an extravagant and famous socialite living in Paris. 8. Graff Vivid Pink – 38,7 million euros A rectangular 24.78-carat diamond, classi...

TOP LAPTOP BRANDS IN THE WORLD

When going to purchase a laptop, individuals consider different specifications to suit their needs. Finding the desired laptop can seem a daunting task since there are numerous brands in the market. Due to technological advancement, many laptop manufacturers have emerged and if not careful, you may end up a victim of unscrupulous dealers. This article will highlight the top 10 best laptop brands of 2013. All brands are designed in different ways to take care of consumer need. Style, functionality, fashion and size are some of the factors that manufacturers consider when developing laptops. A potential laptop buyer needs to conduct thorough research prior to settling for any deal. Below is a compiled list of top laptop brands that can be helpful to any laptop buyer. 10 MSI Laptop Brand Sets the bar for all Haswell gaming laptops Micro-Star International is one of the best and least popular laptop brands. This company has been in existence since 1986 and is a renowned IT manu...

Top 10 largest Mobile Companies in the World – 2018

10 leading mobile companies in the world 1. Samsung Samsung is ruling the mobile market all over the world. Presently it is the leading smartphone company globally. In Q2 2017, Samsung market share was 22%. Point to Ponder Clearly, Samsung is the leader in terms of its sales, performance, and market share but in 2017 there was not much growth in the sales of Samsung. Galaxy S8 and S8+ did good but the sales of mid-range J and A series of Samsung phones declined which is a point to ponder for the company. 2. Apple In the smartphone market, the identity of Apple is iPhone and it is the reason for Apple’s second position in the smartphone market. In Q1 2017 the market share of Apple was 14.7%. In 2017 Apple’s iPhone X was the most innovative phone of the year and it was included in the list of 25 best inventions of the year. Point to Ponder Apple should look ahead to know what it has to achieve yet but look down as well. Be aware of the mobile companies ...