Video není dostupné.
Omlouváme se.
C_32 C Program to make simple calculator using Switch Case | C Language Tutorials
Vložit
- čas přidán 12. 01. 2021
- We will write a C Program to make Calculator using Switch case.
Best C Programming Tutorials : • Programming in C
*******************************************
Connect & Contact Me:
My Second Channel Link: bit.ly/354n7C7
Facebook: / jennys-lectures-csit-n...
Quora: www.quora.com/...
Instagram: / jayantikhatrilamba
Twitter: / khatrijenny
*********************************************
More Playlists:
C++ Programming Tutorials: • Lec 1: How to Install ...
Placement Series: • Placements Series
Data Structures and Algorithms: https: • Data Structures and Al...
Design and Analysis of Algorithms(DAA): • Design and Analysis of...
Python Full Course: • Python - Basic to Advance
Printing Pattern in C: • Printing Pattern Progr...
Dynamic Programming: • Dynamic Programming
Operating Systems: // • Operating Systems
DBMS: • DBMS (Database Managem...
#cprogramming #jennyslectures #programming #clanguage
I'm a software developer working since 3 year in industry but still I watch your all videos because of your impressive teaching. It make me feel that I'm still a student... ❤️
Kaun se company me kaam karte hi
yeah she is really good
#include
int main()
{
float a,b;
char x;
printf("hello user
");
printf("Enter two numbers:
");
scanf("%f %f",&a,&b);
printf("Enter + or - or / or *:
");
scanf("%c", &x);
switch (x)
{
case '+':
printf("The value of addition is %f
", a + b);
break;
case '-':
printf("The value of substraction is %f
", a - b);
break;
case '*':
printf("The value of multiplication is %f
", a * b);
break;
case '/':
printf("The value of division is %f
", a / b);
break;
default:printf("invalid input
");
}
printf("Thank You");
return 0;
}
/*I am facing a problem while running this.*/
The output is like:
hello user
Enter two numbers:
5 7
Enter + or - or / or *:
invalid input
Thank You
The problem is when I press the Enter key after entering first inputs(numbers),the program ends and print as above and doesn't take the input for the operator. What's the problem? Can anyone please answer
@@simon-gh1pttry using int a,b; instead of float a,b;
@@simon-gh1pt You have to either write scanf(" %c", &x); (WITH THE SPACE BEFORE THAT %c -> because it will jump over the
used) or just simply don't write those
at the beginning since those are not helping at all in the very first start.
Please start C# course from scratch to expert level, by the way excellent teaching skills.. I said it before and I must say again.. such a beautiful and intelligent brain 🧠 is hidden in a beautiful and innocent soul, respect from Pakistan, stay always blessed..
c# programming language is best for app development and it is easy too but c++ and java far better and c++ best language in the world it as so benefits than other languages but it is so hard you can also do robotics using c++ so learn c++ or java instead .
@@sujathanarayana2286 nowadays c++ is not much in use.. python has more demand than any other language cuz it gives a lot advantages to developers
For flipping the values a and b, we will write the scanf function like this scanf("%d %d", &b,&a);
exactly
No bro you will need to declare another variable c and and some declerative statement to flip the value
@@studyadda-25 yes bro you are right but the one I have written above is a cheat method 😂 just for fun😅
In this pandemic situation... Your videos are very helpful to me to understand c programming.. Thank you mam❣️
Hi bro, how's your study going?
If we will not write break then it will evaluate addition as well as subtraction because the next break statement is after subtraction.
Thank you mam for regular uploading your video
You are the real avtar of Saraswati maa !!
I am understand this program 👍🙏 mam tysm mam
I am so happy I discovered your courses, you are the best teacher ever
13:15 the next case that is case ' - ' will also be executed. And the break statement of case ' - ' will terminate the switch
ma'am is there is chance of data loss if do 5/2? output will be 2 instead of 2.5
as you told us in pervious video we can't use float data type in switch case, plz me alternative of float which can be use here
If we remove break statement in case'+', the control will go to case'-' and give its value along with case'+'
eg: a = 2 b=3
case'+' = 5
case'-' = -1
It gives the value of all the operator until u come to the default part.
@@Amit_iPhone_shorts
No dear,the keyword "break" ultimately stops the controller as soon as it prints the values of substraction.
Excuse me..
Mam
There is no error in program but I am taking a, b values from user but in output it is not shows
It's due to bufferflow error of scanf
To enter 3 for a and 2 for b:
scanf("%d %d", &a,&b);
or simply you can type 3 as the first value and 2 as the second value
if you fail to write break at case '+'
the statement will be printed, but another case too will be printed if it matches the expression, and then default will be printed
Thank you mam, now this is clear to me
Mam ur like a goddess to me. Thank u for explaining c program very clearly.
Thanks mam...For giving easy expalination and without any confusion..
without break is gives a sum is a+b and printf statemnts and also nest statement will be executed and next in line are given break stop the loop
not writing default after case complete it will not give error but it will execute next case also without checking condition it execute untill breaks coming
Watched and Understood ❤
Greatly explained....
Plzz.. do practical part on PC...
Ma'am Thank You So Much for the Videos
I recently subscribed to you're channel and I wanted to know more about you're professional background but couldn't find any such info available
Please discuss your lectures on vs code editor 👍
Which is your native language
1st qn: scanf("%d %d",&b,&a);
2nd qn:if we not use "break" then it will execute the undesirable part also and will not break the sequence
Without break , the program continues to the next labeled statement, executing the statements until a break or the end of the statement is reached.
Mam is so pretty 😊
We can give logic without declaring sum sub replacing (a+b,a-b)
I love your way of teaching madam
thank you so much
Mam your way of explanig is next leval god bless you mam💕🦋
Thanks alot mam
Good morning mam please use whiteboard for making understand as it gives clear visualisation of dry run .as After watching I use IDE to run program and it become easy after only having clear understand from whiteboard you taught.
And please do upload for function . Thankyou
Please use IDE
Maim voice and teaching techniques is very good
Tq mam,
U r good teacher
if we use + operator which is given by user then if we forget the break statement in last it will continue the next case which is (-) subtraction then it will stop due to that statement has break:
maam plz give light on how to check even odd by switch
Creation of Binomial queue?
Love from NEPAL🇳🇵🇳🇵
hello maam, it is good way to teach and understand the programming using white board max,
use just ide to show, execute, and run,
using white board to teach is best for memorization and understanding,
because we should practice after watch your videos
thankyou
how to write code to find uppercase or lowercase using switch case
How to do division if a
declare a float variable for a and b
It doesn't work like that in programming
When it's something like a
I hope u know the working of / and %
If a
Hope u understand my points
When a
Thank u mam for your amazing reaching 🤗
Thanku for everything mam
Thanks a Lot Mam
Mam,use ide for understanding examples and use white board for concept
Make videos on java programming please mam..
Mam ur looking very cute and super 😍
Another banger baby clam down ,calm down
I am already have made the program using switch case
Thank you mam 🔥🔥🔥
One doubt mam if we first scan numbers it is giving invalid output but if we first scan operators it is giving correct output can u plz explain mam
Same doubt
if we don't write break it will not get out of the loop after getting desired answer and also prints the next case values.
Mam hat's off to ur effort
we will & b,&a to store 3 in a 2 in b
12:05 swapping a two numbers
1) using third variable
Temp=a;
a=b;
b=Temp;
2) without using third variable
a=a+b;
b=a-b;
a=a-b;
3) using bitwise xor
temp=a^b;
a=temp^a;
b=temp^b;
@jenny's lecture CS IT
lol sigma male - scanf("%d%d",&b,&a);
now b=2,a=3;
Thankyou knowledges😊
if will not apply break after + then we will get sub also and if we eliminate break then we will get all result on same time i.e sum,subs.mul,div
It is helpful thank you
Nice ❤️❤️❤️❤️👍👍👍👍👍👍
void main{)
int a,b,temp;
char operator;
printf("Enter a operator:");
scanf("%c",&operator);
printf("Enter 2 numbers");
scanf("%d%d",&a,&b);
temp=a;
a=b;
b=temp;
switch(operator)
{
}
Is it necessary to print operator first in the above calculator program.
Yeah..then only we will get output
@@chithraboominathan9652 But why?
@@MrAlpha-gn7qg Because, in the above program..switch expression we take is an operator.. when we enter an operator..then only the control will go inside the switch case and the corresponding task would be executed.
@@chithraboominathan9652 I am asking why we can't printf operands before operator?? Bcz if we did, the program is not working?... Is it necessary to printf operator first???
Mam respect from Bangladesh. Please continue your great work, you have a great heart.
#include
#include
int main()
{
float num1,num2,result;char op;
scanf("%f%c%f",&num1,&op,&num2);
switch(op)
{
case '+':result=num1+num2;break;
case '-':result=num1-num2;break;
case '*':result=num1*num2;break;
case '/':result=num1/num2;break;
}
printf("Result = %.4f",result);
getch();
}
There is ni pf function
Can you make an vidio regarding AMCAT test..plz.😊
Nice lecture mam
Dear madam, why its not accepting scanf() char variable choice, when we enter this order. but if we enter the symbol first and entering number following is allowed, but if we entered the a = 10 and b = 20 those should store separate memory location and could be called by case statements in switch function. ? please help. - Thanks
printf("Enter 1 integer numbers
"); scanf("%d", &a);
printf("Enter 2 integer numbers
"); scanf("%d", &b);
printf("a. Addition
b. Subtraction
c. Multiplication
d. Division
");
printf("Enter your choice :");
scanf("%c",&choice);
// from here onward
switch(choice)
case: 'a'
// addition will perform, and other operations ..... etc
printf*
%d + %d = %d", a,b,a+b);
I'm facing the same issue. If we enter the numbers first and then enter the operator, it is not accepting the input of characters. Why? idk
Use ch instead of c
Super mam🤟🤟
// Online C compiler to run C program online
#include
int main() {
// Write C code here
int a,b,choice;
printf("ente the two value");
scanf ("%d %d",&a,&b);
printf ("
enter 1 for addition" );
printf ("
enter 2 for subtrct");
printf ("
enter 3 for multiple");
printf ("
enter 4 for divison");
printf ("
enter 5 for modulus ");
printf("
enter choice");
scanf("%d",&choice);
switch (choice)
{
case 1:
printf (" the add is =%d",a+b);
break;
case 2:
printf (" the sub is =%d",a-b);
break;
case 3:
printf (" the mul is =%d",a*b);
break;
case 4:
printf (" the division is =%d",a/b);
break;
case 5:
printf (" the modules is =%d",a%b);
break;
default :
printf ("out");
}
return 0;
}
Mam another method of calculator using switch statement
Mam, please use both IDE and whiteboard.
Wish i had you as my teacher in my university.
Amazing ma'am
I think we have to assign 0 to all sum,div,sub,multi=0 othervice it gives an ERROR
It will give error in loop like when u write
sum += i cuz computer doesn't know what initial value is there in sum, but in case of addition it's ok if we don't assign 0 to sum
Mam please make videos on 4th module Arithmetic of computer organization sub 18CS34
Both addition and subtraction will be performed
If break stmt is removed stmt of case one and case two both will be displayed
Switch to 'turbo c' mam.we will understand that programs very well mam 😁
Thankyou maam.
Mam please work on Visual studio or on Dev
Mam I have a small doubt
#include
void main()
{
int movie = 1;
switch (movie
If i am entering + and not writing break the sum will print 3 times(2nd answer)
Thanks mam
First we enter a operator and we should enter a value that is the only way ??
First I enter a value the i will enter a operator it wouldn't run
If i were your age ,i would marry you😊
Yes maim pls use....screen..
It's my first comment
Ma'am Hindi ma video hota to aur jaya acha sa samaj ma aata
Thanku ma'am 🙂
Can you do a video for object oriented development please
White board is good mam
Good
Make vidio on nested switch..
Plz Mam make A video Of Nested Switch Program
Viewed in 17 sec
Ok mam
miss you not teached nested switch case.
please start core java mam
+,-,*.. these are arithematic operator know mam we can write as char opperator?Pls reply
mam is there any limit to c programming or a last concept in c
how can i write a program in c language to make a calculator like smartphone calculator.
eg:- if we write 9+8=17-5=15/3=5
like this i want to make calculator maam
mam please use ide
Why do we use getch() at the end mam