Without Using Arrays
Program:
#include<stdio.h>
main()
{
int n,m,i,max;
printf("How many numbers(n) you going to enter:");
scanf("%d",&n);
printf("Enter the numbers:");
scanf("%d",&m);
max=m;
for(i=2;i<=n;i++)
{
scanf("%d",&m);
if(m>max)
max=m;
}
printf("The Largest Number is %d",max);
}
Output:
How many numbers(n) you going to enter:5
Enter the numbers:
25
410
362
5
56
The Largest Number is 410
With Using Arrays
Program:
#include<stdio.h>
#include<conio.h>
void main()
{
int max_num(int a[],int n);
int max,i,n;
int a[50];
clrscr();
printf("Enter n number:");
scanf("%d",&n);
printf("Enter the numbers:");
for(i=0;i<n;i++)
scanf("%d",&a[i]);
max=max_num(a,n);
printf("The largest number is %d",max);
getch();
}
int max_num(int a[],int n)
{
int i,m=0;
for(i=0;i<n;i++)
{
if(a[i]>m)
m=a[i];
}
return m;
}
output:
Enter n number:10
Enter the numbers:
123
456
789
963
852
147
5
56
600
753
The largest number is 963
program to find maximum of two numbers using pointers
write an assembly language program to find sum of N numbers
VBnet program to find the prime numbers between 100 to 200?
To find the largest of three numbers, first find the largest of two numbers: int max (int x, int y) { return x<y?y:x; } Now you can use this one function to find the largest of three numbers: int max (int x, int y, int z) { return max (max (x, y), z); }
k
int i, largest=0;do { scanf ("Enter a number (0 to exit): %d", i); if (i>largest) largest=i; } while (i!=0); printf ("Largest number is: %d\n", largest);
Find the largest of two, then find the largest of that value and the third value. int* max (int* a, int* b) { return (a*) > (b*) ? a : b; } int* max_of_three (int* a, int* b, int* c) { return max (max (a, b), c); }
Write your own prime number program and find out.
i need this answer
Please visit http://talentsealed.blogspot.com/2009/10/to-find-sqaure-of-numbers-using-c.htmlfor the answer.
Since there is an infinite set of prime numbers the answer would be infinity.
List the factors of each of the numbers in the set. Write down the numbers that appear on all the lists. Choose the largest one.