Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<conio.h>
- main ()
- {
- /* n1 for 1st number
- n2 for 2nd number
- r for result
- x for your opretion ( that is mean what you want to do?)
- o for opson ( that is mean do you want it again?) */
- printf ("Welcome to Milan's calculator\n");
- char o;
- do{
- double n1,n2,r;
- printf( "Input your Number\n");
- scanf("%lf %lf",&n1,&n2);
- printf("Input Your opratino \n");
- char x;
- scanf(" %c", &x);
- if (x == '+')
- {
- r = n1 + n2;
- }
- else if (x == '-' )
- {
- r=n1 - n2;
- }
- else if (x == '*')
- {
- r = n1 * n2;
- }
- else if (x =='/')
- {
- r =n1 /n2 ;
- }
- else
- {
- printf(" You give wrong input\n");
- }
- printf(" Our result is %lf\n",r);
- printf(" \n do you want to continue y/n?\n");
- o =getch ();
- }while(o =='y');
- printf(" END\n");
- getch ();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement