#include<stdio.h>
void main()
{
int a[10],n,i,large,small;
printf("enter the value of n\n");
scanf("%d",&n);
printf("enter the elements\n");
for(i=0;i<n;i++)
scanf("%d",&a[i]);
large=a[0];
small=a[0];
for(i=1;i<n;i++)
{
if(a[i]>large)
large=a[i];
if(a[i]<small);
small=a[i];}
printf("largest element in the array id %d\n",large);
printf("smallest element in the array is %d\n",small);
}
Use the following algorithm (written in pseudocode). Let largest be the lowest possible real number. Let smallest be the greatest possible real number. Repeat while there is input... { Read real number r from input. If r is greater than largest then let largest be r. If r is less than smallest then let smallest be r. } End repeat. Let range be largest minus smallest. Output range.
smallest: zero largest: five thousand
k
Name two variables x and y. Divide the largest by smallest. If remainder is zero then the smallest is the HCF.
write a c program to fine largest/smallest of 3no (using ?:ternary operator/conditional operator)
final double[] ns = new double[10]; final Random rnd = new Random(System.currentTimeMillis()); // Fill... for (int i = 0; i < ns.length; ++i) { ns[i] = rnd.nextDouble(); } // Get largest/smallest... double largest = Double.MIN_VALUE; double smallest = Double.MAX_VALUE; for (double n : ns) { if (n > largest) { largest = n; } if (n < smallest) { smallest = n; } } // largest and smallest are now the proper values.
The smallest 5 digit number you can write is 10000.
Write your own prime number program and find out.
You can create a Shell script to find the smallest digit of a number by iterating through its digits. Here's a simple example: #!/bin/bash read -p "Enter a number: " number smallest=9 for (( i=0; i<${#number}; i++ )); do digit=${number:$i:1} if (( digit < smallest )); then smallest=$digit fi done echo "The smallest digit is: $smallest" This script prompts the user for a number, checks each digit, and prints the smallest one.
just go the reverse of how they are listed now they are currently largest to smallest
what is if(!(str[i]==32))
I believe the answer is: 7,7,11