Skip to main content

Featured

C Program to display spellings of number 1-10 on entry

C Program to display spellings of number 1-10 on entry.   #include<stdio.h>   void main() { int num; printf("Enter a number between 1-10:"); scanf("%d",&num); printf("\n"); switch (num) { case 1: printf("ONE"); break; case 2: printf("TWO"); break; case 3: printf("THREE"); break; case 4: printf("FOUR"); break; case 5: printf("FIVE"); break; case 6: printf("SIX"); break; case 7: printf("SEVEN"); break; case 8: printf("EIGHT"); break; case 9: printf("NINE"); break; case 10: printf("TEN"); break; default:         printf("THE ENTERED NUMBER IS NOT BETWEEN 1-10"); } } OUTPUTS

C Program to find the largest and smallest number from array elements

C Program to find the largest and smallest number from array elements

#include<stdio.h>
void main()
{
int n, ar[100],large=0,small=0,i;
printf("How many elements to be inserted? ");
scanf("%d",&n);
printf("\nEnter the array elements:\n");
for(i=0;i<n;i++)
{
scanf("\n%d",&ar[i]);
}
large=ar[0];    
small=ar[0];
for(i=0;i<n;i++)
{
{
if(ar[i]>large)
large=ar[i];
        }
{
if(ar[i]<small)
small=ar[i];
}
}
printf("\nLargest=%d \nSmallest=%d",large,small);
}


OUTPUTS



Comments