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...

Realme 3 Pro vs Redmi Note 7 Pro Camera Comparison: And the Winner is?

With a profoundly aggressive price tag, Realme 3 Pro made its  official debut  in India just earlier this week to take on the smartphone, which is better known as the budget king – Redmi Note 7 Pro. The cameras are important for when you make a buying decision and while Xiaomi has banked on the hype around 48MP sensors to court buyers for its latest budget offering, Realme has resorted to borrowing the camera sensor from its sister company’s flagship smartphone – the OnePlus 6T. So, let’s not waste any more time and answer the one question which might have been bugging you. How does the Sony IMX519 sensor on Realme 3 Pro compare to the Sony IMX586 on Redmi Note 7 Pro? Realme 3 Pro vs Redmi Note 7 Pro: Specs Before we check out the camera samples and see how they compare, here’s a quick peek at the camera specifications for both the smartphones. The Redmi Note 7 Pro, as most of you, would already know brings along  a primary 48MP (f/1.7) rear sensor (the Sony I...

Some basic and necessary information about c language you don't know

C is a general-purpose, high-level language that was originally developed by Dennis M. Ritchie to develop the UNIX operating system at Bell Labs. C was originally first implemented on the DEC PDP-11 computer in 1972. In 1978, Brian Kernighan and Dennis Ritchie produced the first publicly available description of C, now known as the K&R standard. The UNIX operating system, the C compiler, and essentially all UNIX applications programs have been written in C. The C has now become a widely used professional language for various reasons. Easy to learn Structured language It produces efficient programs. It can handle low-level activities. It can be compiled on a variety of computer platforms. Facts about C C was invented to write an operating system called UNIX. C is a successor of B language which was introduced around 1970 The language was formalized in 1988 by the American National Standard Institute (ANSI). The UNIX OS was totally written in C by 1973. To...