#include<stdio.h>
#include<conio.h>
int func(void);
void main(void)
{
clrscr();
printf("Enter five digit number: ");
printf("nnnSum of entered number is %d",func());
getch();
}
int func(void)
{
int b=0,a;
while((a=getche())!='r')
b+=a-=48;
return b;
}
write a scripting to return values in functions
Classes cannot return values, only functions can return values. But you cannot return a function from a function, you can only return a function pointer -- a pointer variable holding the address of the function you wish to return. All possible return values must be of the same type, therefore all function signatures and return types must be exactly the same -- only the name of the functions can differ.
write a program that reads a phrase and prints the number of lowercase latters in it using a function for counting? in C program
Sure: int main (void) { puts ("Hello, world"); return 0; }
int 2n(int n){return n << 1;)
write a scripting to return values in functions
You can use the Math.pow function to raise one number to the power of another. Math.pow(24, 3) will return 243
question clarity
void mynullfunction () {;}
Classes cannot return values, only functions can return values. But you cannot return a function from a function, you can only return a function pointer -- a pointer variable holding the address of the function you wish to return. All possible return values must be of the same type, therefore all function signatures and return types must be exactly the same -- only the name of the functions can differ.
Yes
You can write a program without specifying its prototype when the function returns an integer.If the prototype is not mentioned the compiler thinks that the return type of the function used is integer.When making program which return integer you can ignore writing the protoype.
#include<iostream.h> int CheckPrime(int number){ for(int i=2;i<number;i++){ if(number%i==0) return 0; } return 1; } void main() { int num=7; cout<<CheckPrime(num); }
To write a program that calculates the factorial of a number in PHP, you can use a recursive function or an iterative approach. Here’s a simple example using a loop: function factorial($n) { $result = 1; for ($i = 2; $i <= $n; $i++) { $result *= $i; } return $result; } echo factorial(5); // Outputs: 120 This code defines a function that multiplies numbers from 2 up to the given number $n to compute the factorial.
int main() { // Call the printf function printf("This is a function call!\n"); return 0; }
There will be a function in it like this: double RectangleArea (double a, double b) { return a*b; }
Python programming allows you to write your own programs. For example, to write a function named double that returns the number that you input, but doubled, we would write the following (where >>>> indicates a tab space) def double(x): >>>>x=x*2 >>>>return x