how to find out the biggest element (or any other
operation) in an array which is dynamic. User need not to
mention the array size while executing.
Answers were Sorted based on User's Feedback
#include<stdio.h>
#include<conio.h>
void main()
{
int n,BIG;
printf("enter the numbers :");
scanf("%d",&n);
BIG=n;
do
{
fflush(stdin);
scanf("%d",&n);
if(n>=BIG)
BIG=n;
}while(((char)n>=65)&&((char)<=122));
printf("the biggest number is : %d",BIG);
getch();
}
it is a good one..
But if the user not give the array size,by using sizeof()
operator we can find the array size then by dividing the
total size with the size of data type ,we can find the
number of elements in the array then after we can find the
largest number of the array .
| Is This Answer Correct ? | 0 Yes | 1 No |
it is said that while executing also the user should not specify the size means it can be done in another method without using ARRAYS......... using only one variable.. since it is asked to find only the biggest element , this program suits.....
#include<stdio.h>
#include<conio.h>
void main()
{
int n,BIG;
printf("enter the numbers :");
scanf("%d",&n);
BIG=n;
do
{
fflush(stdin);
scanf("%d",&n);
if(n>=BIG)
BIG=n;
}while(((char)n>=65)&&((char)<=122));
printf("the biggest number is : %d",BIG);
getch();
}
thank u
| Is This Answer Correct ? | 0 Yes | 3 No |
to find the closest pair
What will be the outcome of the following conditional statement if the value of variable s is 10?
Reverse the part of the number which is present from position i to j. Print the new number. eg: num=789876 i=2 j=5 778986
How to explain the final year project as a fresher please answer with sample project
char *p="name"; printf(p);
what is the diference between pointer to the function and function to the pointer?
implement NAND gate logic in C code without using any bitwise operatior.
Why do we use stdio h and conio h?
main() { int *ptr=(int*)malloc(sizeof(int)); *ptr=4; printf("%d",(*ptr)+++*ptr++); }
Combinations of fibanocci prime series
what is the mean of c languages.
Explain setjmp()?