C_88 Functions in C -part 5 | Function with No Argument No Return Type
Вставка
- Опубліковано 6 вер 2021
- C complete playlist: • Programming in C
Connect & Contact Me:
Vlogging Channel Link: bit.ly/354n7C7
Facebook: / jennys-lectures-csit-n...
Quora: www.quora.com/profile/Jayanti...
Instagram: / jayantikhatrilamba
Twitter: / khatrijenny
See Complete Playlists:
Placement Series: • Placements Series
Data Structures and Algorithms: https: • Data Structures and Al...
Design and Analysis of Algorithms(DAA): • Design and Analysis of...
Dynamic Programming: • Dynamic Programming
Operating Systems: // • Operating Systems
DBMS: • DBMS (Database Managem...
#whatisFunctioninC
#NoArgumentNoReturnType
#jennyslectures
Answer to the Assignment:-
#include
void sum(void);
void subtract(void);
void multiply(void);
void divide(void);
void main()
{
sum();
subtract();
multiply();
divide();
}
void sum()
{
int a, b, sum = 0;
printf("Enter a and b: ");
scanf("%d %d", &a, &b);
sum = a + b;
printf("Sum = %d
", sum);
}
void subtract()
{
int a, b, diff = 0;
printf("Enter a and b: ");
scanf("%d %d", &a, &b);
diff = a - b;
printf("Difference = %d
", diff);
}
void multiply()
{
int a, b, prod = 0;
printf("Enter a and b: ");
scanf("%d %d", &a, &b);
prod = a * b;
printf("Product = %d
", prod);
}
void divide()
{
int a, b;
float div = 0.0;
printf("Enter a and b: ");
scanf("%d %d", &a, &b);
if(b == 0)
printf("Divide by 0 not possible");
else
{
div = (float)a / (float)b;
printf("Division = %f
", div);
}
}
Homework assignment:
//Write 4 functions: addition, subtraction, multiply, divide;
//All 4 functions you will call in main() function;
//These function should fall in the 1st category: No argument, No return type! :)
#include
void add(void);
void sub(void);
void mult(void);
void div(void);
int main(void)
{
add();
sub();
mult();
div();
}
void add()
{
int x = 10, y = 5, add = 0;
add = x + y;
printf("Addition = %d
", add);
}
void sub()
{
int x = 10, y = 5, sub = 0;
sub = x - y;
printf("Subtraction = %d
", sub);
}
void mult()
{
int x = 10, y = 5, mult = 0;
mult = x * y;
printf("Multiplication = %d
", mult);
}
void div()
{
int x = 10, y = 5, div = 0;
div = x / y;
printf("Division = %d
", div);
}
Output:
Addition = 15
Subtraction = 5
Multiplication = 50
Division = 2
where r u from?
Thanks😊
you forgot to write return value for int main
Is it OK to write void in the main function?
I mean void main( )
Shouldn't it be like this?
I don't mam how I would thank u. You are like a universal mother teacher who is taking care of her students as a mother.
Here is First Assingment from my side:-
// No argument without return type function
#include
void sum(void);
void sub(void);
void mult(void);
void div(void);
void main()//calling function
{
sum();
sub();
mult();
div();
}
void sum()//called functio
{
int a=5, b=2, sum;
sum = a+b;
printf("sum = %d
", sum);
}
void sub()
{
int a=5, b=2, sub;
sub = a-b;
printf("sub is %d
", sub);
}
void div()
{
int a=5, b=2, div;
div = a/b;
printf("div is %d
", div);
}
void mult()
{
int a =5, b=2, mult;
mult = a*b;
printf("multiplication is %d
", mult);
}
Sum=7
Sub is 3
div is 2
Multiplication is 10
thanks
#include
void sum(void);
void main()
{
sum();
}
void sum()
{
int a=5,b=7;
printf("sum is %d
",(a+b));
printf("subtraction is %d
",(a-b));
printf("mult is %d
",(a*b));
printf("divi is %d
",(a%b));
}
you can write with one called function bro
@@Ramya0216 ss
@@sharojshaik9519 no it's wrong...we have to declare the function first and next we have to define that function....
Ma
I love your teachings, now I'm understanding these function issues
Thanks very very much
Your explanation is simple to understand compared to other video tutorial UA-cam
Once again, thanks 👍
you teach with more insights of concepts and that's why really appreciate the way you explain
Cant be best than this mam. Thank you for the videos.
Last assignment , here as we have given void parameter in function definition only so the error was not given and the argument has been discarded , but as in function definition is returning int value the compiler is asking us to initialise int main() rather than void main ()
#include
void fun();
int main()
{
fun(5,6);
}
void fun(void)
{
int x=4,y=8,sum =0;
sum = x+y;
printf("sum = %d",sum);
}
Mam thanks for your efforts
printf("Madam Jenny, you are too good, your explanation is superb. I wish you should teach me forever");
Hi Mrs Jenny i am from Cameroon 🇨🇲 Africa. all ur videos are 🔥🔥 I am learning alot
assignment will be it wont throw error instead it shows warning implicit of declaration the output will be executed.
thank you so much mam
Mam can you please tell about
Call by refrence
Thank you mam
Which app is best to perform c programs??
Easily understand mam.. i love you mam
Nice explanation 👍🏻
very best lecture of functions!!!!!!!!!!🙂🙂🙂
Nice
THANK YOU!!
I came here just for revision and it helped me a lot ...
thanks from Bangladesh
Mam is universal mother as well as goddess
No error output is correct
types of functions and classification of functions are same ?
the last question came error
#include
void vig();
void vig(void){
int a=10,b=20;
printf("
%d%d",a,b);}
void main(){
vig(11,25);}
// some undeclare the void can correct of the program can output display...
And actual parameter not passing the variable can display without any error or warning.
When we use void in definition function and in calling function it is implicitly assuming that data type is int and gives the o/p with warning ..but in case of float in the definition function why is it not giving any o/p?
We are not using void in calling function and we are using float in declaration function and function definition
Ma'am i want to work with you as a thumbnail editor plz reply me if you are interested in it i will send some samples.
Thank you.
Can you explain prototype of function
Mam app jo bhi Bolte ho Bahut ache lagte ho
Mam argument means parameter ?
Hello mam
I'm facing the problem in this program
I've understood everything thing but wherever
I run this it shows me error
gcc /tmp/uizp4vwY8K.c -lm
/tmp/uizp4vwY8K.c:8:1: error: expected identifier or '(' before '{' token
8 | {
| ^
@Aman Sharma
I guess u might have forgotten the semicolon while declaring the function...
//Argument with return type
#include
int sum(int,int); //declaration//
int sub(int,int);
int mul(int,int);
int div(int,int);
int main()
{
sum(6,3);//calling//
sub(6,3);
mul(6,3);
div(6,3);
}
int sum(int a,int b) //defnition//
{
int sum=0;
sum=a+b;
printf("sum=%d
",sum);
return sum;
}
int sub(int a,int b)
{
int sub=0;
sub =a-b;
printf("sub =%d
",sub);
return sub;
}
int mul(int a,int b)
{
int mul=0;
mul = a*b;
printf("product =%d
",mul);
return mul;
}
int div(int a,int b)
{
int div;
div=a/b;
printf("div =%d
",div);
return div;
}
God🛐
Mam you are really beautiful I can’t concentrate on this lecture just because of your charm
Bull shit guy she is your teacher respect her
Bhai pagal hey kya tu 🤦
Mereko to Maja Aata hai Vai inka lecture sunne me ❣️
Lots of love mam from Nepal 🇳🇵🇳🇵🇳🇵🇳🇵
😂😂😂😂a
Me who is watching the videos because of Mam's charm 😂😂😂
😂🤭🤭😂
Which compiler you use for compilation I mean which site
Even I don't no c but now I am relaize in c because of u MAM ❤️🔥🫶🫶
Hi mam
You will take lectures related to b.tec or cse students mam???
I am going to take cse mam
Plz help me mam I am beginner
Bro this course is made for beginner to advance level .You should start from 1st video.
Mam i forgot the year in which you got the miss world award can you please tell me?
Forces 99%
Leading 1%
Just Legends things 😂😂
Error was an extra parameter is added
Ma'am bcha liya aapne muze🙇♀️
I also have same situation,
14:14 error are as follow of this program when compiled in DEV C++ compiler
D:\C With Pradip\practice\Untitled2.cpp In function 'int main()':
7 8 D:\C With Pradip\practice\Untitled2.cpp [Error] too many arguments to function 'void fun()'
3 6 D:\C With Pradip\practice\Untitled2.cpp [Note] declared here
D:\C With Pradip\practice\Untitled2.cpp In function 'void fun()':
12 1 D:\C With Pradip\practice\Untitled2.cpp [Error] expected primary-expression before '/' token
12 2 D:\C With Pradip\practice\Untitled2.cpp [Error] expected primary-expression before 'int'
14 6 D:\C With Pradip\practice\Untitled2.cpp [Error] 'a' was not declared in this scope
14 8 D:\C With Pradip\practice\Untitled2.cpp [Error] 'b' was not declared in this scope
14:25 answer would be still 12
How
Send classes pdf in description
First view
Love you mama
can we get 5marks for this answer. for 5marks question
Mam es program ka algorithm kaise banaaye
Plz batao na
Your eyes got my heart falling for you .what a nice eyes ,l don't even describe in a word about your eyes
I Think I'm The Second Commenter👍🏻
No need to increase the playback speed mam already speaks in 1.5x😂
Really 😳😂
@@JennyslecturesCSIT I think so 😂
I like coding
complaition error
4 min
I love you mam
Mam can you explain in Hindi and Marathi plz
In functions can we use flaot as retuntype
#include
Main()
{
Float a= 15.5;
Char ch='d';
Printit(a,ch);
}
Printit(a,ch)
{
Printf("
%f %c",a,ch);
}
I am getting a ans 0.0000 in float can I know y and how to solve this prlm
U hv not declare datatype to main functn
Program is wrong
Apko
Nicemam
Here you have it done with some simple conditions for * and /. Here you have it:
#include
void sum(void);
void sub(void);
void mult(void);
void divi(void);
int main() {
sum();
sub();
mult();
divi();
return 0;
}
void sum() {
int a = 5, b = 7, sum = 0;
sum = a + b;
printf("Sum of 5 and 7 is: %d
", sum);
}
void sub() {
int a = 5, b = 7, sub;
sub = a - b;
printf("Sub of 5 and 7 is: %d
", sub);
}
void mult() {
int a = 0, b = 1, mult = 1;
if (a
14:24 no error
correct :)
Hello 😊
y am i getting error saying that return type of main should be int
#include
void sum(void);
void main()
{
sum();
}
void sum()
{
int a=3,b=5,s=0;
s=a+b;
printf("sum=%d",s);
}
bro give your programme name with characters only not with numbers
i e fun.c not fun11.c that means compiles will want return type as int
@@741ibrahim2 ohh ok thank you so much 😀😀
@@shruti2981 no problem
change the code to
int main()
{
sum();
return 0;
}
answer is 12
cute
madam please to explan the telugu madam
14:23 ASSIGNMENT
#include
void sum();
int main()
{
sum(5,4);
return 0;
}
void sum(void)
{
int a=5,b=7,sum=0;
sum=a+b;
printf("Sum=%d",sum);
}
OUTPUT: too many augments to function void sum()
homework mam 7:50
#include
void add(void);
void sub(void);
void mux(void);
void div(void);
int a , b;
void main()
{
printf("Enter integer values of a and b : ");
scanf("%d,%d",&a,&b);
add();
sub();
mux();
div();
}
void add()
{
int sum = 0;
sum = a + b;
printf("a + b is : %d
",sum);
}
void sub()
{
int sub = 0;
sub= a - b;
printf("a - b is : %d
",sub);
}
void mux()
{
int mux = 0;
mux= a * b;
printf("a * b is : %d
",mux);
}
void div()
{
int div = 0;
div = a / b;
printf("a / b is : %d
",div);
}
For the question asked at 8:00
#include
void add(void);
void sub(void);
void mult(void);
void div(void);
void main(void)
{
add();
sub();
mult();
div();
}
void add(void)
{
int a, b, sum;
printf("Enter two numbers: ");
scanf("%d %d", &a, &b);
sum = a + b;
printf("Sum: %d
", sum);
}
void sub(void)
{
int a, b, sub;
printf("Enter two numbers: ");
scanf("%d %d", &a, &b);
sub = a - b;
printf("Sub: %d
", sub);
}
void mult(void)
{
int a, b, mult;
printf("Enter two numbers: ");
scanf("%d %d", &a, &b);
mult = a * b;
printf("Sum: %d
", mult);
}
void div(void)
{
int a, b, div;
printf("Enter two numbers: ");
scanf("%d %d", &a, &b);
div = a / b;
printf("Div: %d
", div);
}
#include
float sum();
void main()
{
sum();
}
float sum()
{
float a,b,sum=0;
printf("enter two number");
scanf("%f%f",&a,&b);
sum=a+b;
printf("sum=%f
",sum);
sum=a-b;
printf("sum=%f
",sum);
sum=a*b;
printf("sum=%f
",sum);
sum=a/b;
printf("sum=%f
",sum);
}
Assignment Submission:
#include
void sum(void);
void sub(void);
void div(void);
void mult(void);
void main()
{
sum();
sub();
div();
mult();
}
void sum()
{
int a=5,b=7,sum=0;
sum=a+b;
printf("sum=%d
",sum);
}
void sub()
{
int a=7,b=2,sub=0;
sub=a-b;
printf("sub=%d
",sub);
}
void div()
{
int a=10,b=2,div=0;
div=a/b;
printf("div=%d
",div);
}
void mult()
{
int a=7,b=2,mult=0;
mult=a*b;
printf("mult=%d",mult);
}
#include
void sum ();
void sub ();
void mul ();
void div ();
int a,b;
void main(){
char opr;
printf("enter the operator");
scanf("%c",&opr);
printf("enter the value of operands");
scanf("%d %d",&a,&b);//since a and b are global so we can use them anywhere in any function
if(opr=='+')
sum();
else if (opr=='-')
sub();
else if (opr=='*')
mul();
else if (opr=='/')
div();
else
printf("enter valid operator");
}
void sum() {
int sum=0;
sum=a+b;
printf("sum=%d
",sum);
}
void sub(){
int sub=0;
sub=a-b;
printf("sub=%d
",sub);
}
void mul(){
int mul=0;
mul=a*b;
printf("multiply=%d
",mul);
}
void div(){
float div=0;
div=a/b;
printf("div=%f
",div);
}
#include
void sum(void);
void sub(void); //function decleration
void pro(void);
void div(void);
void main()
{
sum();
sub(); //function call
pro();
div();
}
void sum() //function defination
{
int a=5,b=7,sum=0;
sum=a+b;
printf("sum=%d
",sum);
}
void sub()
{
int a=5,b=7,sub=0;
sub=a-b;
printf("sum=%d
",sub);
}
void pro()
{
int a=5,b=7,pro=0;
pro=a*b;
printf("sum=%d
",pro);
}
void div()
{
int a=5,b=7,div=0;
div=a/b;
printf("sum=%d
",div);
}
mam really are married or not ? plz tell us there's surprise for you one of the millionaire ($) person that i know him .
#include
void sum(void);
void sub(void);
void multiply(void);
void divide(void);
int main()
{
sum();
sub();
multiply();
divide();
}
void sum()
{
int a, b, sum;
printf("Enter two numbers(sum) : ");
scanf("%d %d", &a, &b);
sum = a + b;
printf("sum = %d
", sum);
}
void sub()
{
int a, b, sub;
printf("Enter two numbers(sub) : ");
scanf("%d %d", &a, &b);
sub = a - b;
printf("sub = %d
", sub);
}
void multiply()
{
int a, b, multiply;
printf("Enter two numbers(multiply) : ");
scanf("%d %d", &a, &b);
multiply = a * b;
printf("multiply = %d
", multiply);
}
void divide()
{
int a, b, divide;
printf("Enter two numbers(divide) : ");
scanf("%d %d", &a, &b);
divide = a / b;
printf("divide = %d
", divide);
}
#include
void fun();
int main()
{
fun();
return 0;
}
void fun(void)
{
int x=2,y=2,sum=0;
sum=x+y;
printf("sum=%d",sum);
}
it give correct o/p i.e sum=4
How
#include
void fun();
void main()
{
fun();
}
void fun()
{
int a=25,b=8,sum=0;
printf("addition=%d
",a+b);
printf("subtraction=%d
",a-b);
printf("multiplication=%d
",a*b);
printf("division=%d
",a/b);
}
#include
void sum();
void sub();
void mul();
void div();
void main(){
sum();
sub();
mul();
div();
}
void sum(){
int a,b,sum=0;
printf("enter the value of a:");
scanf("%d",&a);
printf("enter the value of b:");
scanf("%d",&b);
sum=a+b;
printf("sum is %d
",sum);
}
void sub(){
int x,y,sub=0;
printf("enter the value of x:");
scanf("%d",&x);
printf("enter the value of y:");
scanf("%d",&y);
sub=x-y;
printf("subtraction is %d
",sub);
}
void mul(){
int p,q,mul=0;
printf("enter the value of p:");
scanf("%d",&p);
printf("enter the value of q:");
scanf("%d",&q);
mul=p*q;
printf("multiplication is %d
",mul);
}
void div(){
int k,j,div=0;
printf("enter the value of k:");
scanf("%d",&k);
printf("enter the value of j:");
scanf("%d",&j);
div=k/j;
printf("division is %d
",div);
}
ASSIGNMENT NO1
#include
void sum();
void sub();
void mul();
void div();
void main()
{
sum();
sub();
mul();
div();
}
void sum()
{
int a=5,b=8,sum=0;
sum= a+b;
printf("sum=%d
",sum);
}
void sub()
{
int a=5,b=8,sub=0;
sub= a-b;
printf("sub=%d
",sub);
}
void mul()
{
int a=5,b=8,mul=0;
mul= a*b;
printf("mul=%d
",mul);
}
void div()
{
int a=5,b=8,div=0;
div= a/b;
printf("div=%d
",div);
}
#include
void sum();
void sub();
void mul();
void divi();
void main()
{
sum();
sub();
mul();
divi();
}
void sum()
{
int a, b, sum=0;
printf("enter two numbers ");
scanf("%d%d",&a,&b);
sum=a+b;
printf("%d", sum);
}
void sub()
{
int a, b, sub=0;
printf("enter two numbers ");
scanf("%d%d",&a,&b);
sub=a-b;
printf("%d", sub);
}
void mul()
{
int a, b, mul=0;
printf("enter two numbers ");
scanf("%d%d",&a,&b);
mul=a*b;
printf("%d", mul);
}
void divi()
{
int a, b, divi=0;
printf("enter two numbers ");
scanf("%d%d",&a,&b);
divi=a/b;
printf("%d", divi);
}
#include
void fun(void);
void main(void)
{
fun( );
}
void fun(void)
{
int a,b,sum=0,sub=0,multi=0,div=0;
printf("Enter a number :");
scanf("%d%d",&a,&b);
sum=a+b;
sub=a-b;
multi=a*b;
div=a/b;
printf("Sum = %d
Sub = %d
Multiply = %d
div = %d
",sum,sub,multi,div);
}
#include
// float sum(void); //Function declaration.
void sum(void);
void sub(void);
void mul(void);
void div(void);
void main()
{
sum(); // Fuction Calling.
sub();
mul();
div();
}
void sum() // Function Defination
{
int a, b, sum = 0;
printf("Enter your Numbers. for addition:");
scanf("%d%d", &a, &b);
sum = a + b;
printf("sum=%d
", sum);
}
void sub()
{
int a, b, sub = 0;
printf("Enter your Numbers. for subtraction:");
scanf("%d%d", &a, &b);
sub = a - b;
printf("sum=%d
", sub);
}
void mul()
{
int a, b, mul = 0;
printf("Enter your Numbers. multiplication:");
scanf("%d%d", &a, &b);
mul = a * b;
printf("mul=%d
", mul);
}
void div()
{
int a, b, div = 0;
printf("Enter your Numbers. for division:");
scanf("%d%d", &a, &b);
div = a / b;
printf("div=%d
", div);
}
Your eyes got my heart falling for you .what a nice eyes ,l don't even describe in a word about your eyes
#include
void sum(void);
void subract(void);
void multiply(void);
void divide(void);
void main()
{
sum();
subract();
multiply();
divide();
}
void sum()
{
int x = 10, y = 2, sum = 0;
sum = x + y;
printf("sum = %d", sum);
printf("
");
}
void subract()
{
int x = 10, y = 2, subract = 0;
subract = x - y;
printf("subract = %d", subract);
printf("
");
}
void multiply()
{
int x = 10, y = 2, multiply = 0;
multiply = x * y;
printf("multiply = %d", multiply);
printf("
");
}
void divide()
{
int x = 10, y = 2, divide = 0;
divide = x / y;
printf("divide = %d", divide);
printf("
");
}
#include
int sum()
{int a, b, sum;
printf("enter a and b:
");
scanf("%d%d",&a,&b);
sum=a+b;
printf("sum=%d",sum);
}
int multiply()
{
int a, b, multiply;
printf("
enter a and b:
");
scanf("%d%d",&a,&b);
multiply=a*b;
printf("a×b=%d
",multiply);
}
subtract()
{
int a, b, subtract;
printf("
enter a and b:
");
scanf("%d%d",&a,&b);
subtract=a-b;
printf("a-b=%d
",subtract);
}
divide()
{
int a, b, divide;
printf("
enter a and b:
");
scanf("%d%d",&a,&b);
divide=a/b;
printf("a/b=%d
",divide);
}
main()
{
sum();
multiply();
divide();
subtract();
}
Thanks hopefully it is right 🙏❤
#include
void sum(void);
void mul(void);
void div(void);
void sub(void);
int main(){
sum();
mul();
div();
sub();
return 0;
}
void sum(){
int a, b;
printf("Enter the two no. for sum :
" );
scanf("%d %d",&a,&b);
int sum = a+b;
printf("%d
",sum);
}
void mul(){
int a, b;
printf("Enter the two no. for mul :
" );
scanf("%d %d",&a,&b);
int mul = a*b;
printf("%d
",mul);
}
void div(){
int a, b;
printf("Enter the two no. for division :
" );
scanf("%d %d",&a,&b);
int div = a/b;
printf("%d
",div);
}
void sub(){
int a, b;
printf("Enter the two no. for subtraction :
" );
scanf("%d %d",&a,&b);
int sub = a-b;
printf("%d
",sub);
}