how to return a multiple value from a function?
Answers were Sorted based on User's Feedback
#include<stdio.h>
#define PI 3.1415
int main()
{
double area,perimeter,radius;
printf("Enter radius of Circle:");
scanf("%lf",$radius);
calculate(&area,&perimeter,radius);
printf("Area of Circle:%lf\nPerimeter of
Circle:%lf",area,perimeter);
}
calculate(double *a,double *p,double r)
{
*a=PI*r*r;
*p=2*PI*r;
}
Is This Answer Correct ? | 3 Yes | 0 No |
Answer / ara
string f()
{
return "a multiple value";
}
:) if this a trick question ...
Is This Answer Correct ? | 1 Yes | 4 No |
Answer / vinayakkatkar
using if else statement
for example
int fun()
{
if(cond1)
return var1;
else
return var2;
}
Is This Answer Correct ? | 1 Yes | 7 No |
How to reverse a String without using C functions ?
33 Answers Matrix, TCS, Wipro,
main(){ char a[100]; a[0]='a';a[1]]='b';a[2]='c';a[4]='d'; abc(a); } abc(char a[]){ a++; printf("%c",*a); a++; printf("%c",*a); }
main(int argc, char **argv) { printf("enter the character"); getchar(); sum(argv[1],argv[2]); } sum(num1,num2) int num1,num2; { return num1+num2; }
Ramesh’s basic salary is input through the keyboard. His dearness allowance is 40% of basic salary, and house rent allowance is 20% of basic salary. Write a program to calculate his gross salary.
main() { char *p="hai friends",*p1; p1=p; while(*p!='\0') ++*p++; printf("%s %s",p,p1); }
write a simple calculator c program to perform addition, subtraction, mul and div.
0 Answers United Healthcare, Virtusa,
how to programme using switch statements and fuctions, a programme that will output two even numbers, two odd numbers and two prime numbers of the users chioce.
0 Answers Mbarara University of Science and Technology,
main(){ int a= 0;int b = 20;char x =1;char y =10; if(a,b,x,y) printf("hello"); }
Find your day from your DOB?
15 Answers Accenture, Microsoft,
main() { int i=5,j=6,z; printf("%d",i+++j); }
main() { int i; printf("%d",scanf("%d",&i)); // value 10 is given as input here }
Write a program to receive an integer and find it's octal equivalent. How can i do with using while loop.