//2062
//Q1.a. write a c prgram to print the 10 positive integers and their factorials.
#include<stdio.h>
#define max 10
void main()
{
int i,j,fact,N[max];
printf(“enter the value of entegers\n”);
for(i=1;i<max;i++)
{
scanf(“%d”,&N[i]);
}
printf(“Number\t Factorial\n”);
for(i=1;i<max;i++)
{
fact=1;
for(j=1;j<=N[i];j++)
{
fact*=j;
}
// printf(“the Number=%d and its Factorial=%d\n”,N[i],fact);
printf(“%d\t%d\n”,N[i],fact);
}
}
OUTPUT

I have given the input in random way.
//1.c.Write a C Program to input ‘n’ numbers and find out greatest and smallest number.
#include<stdio.h>
void main()
{
int i,j,n, a[20],temp;
printf(“enter the size of array\n”);
scanf(“%d”,&n);
printf(“ente the numbers:-\n”);
for(i=0;i<n;i++)
scanf(“%d”,&a[i]); //taking input values
printf(“the input values are:”);
for(i=0;i<n;i++)
printf(“\t%d”,a[i]);
for(i=0;i<n-1;i++)
{
for(j=i+1;j<n;j++)
{
if(a[i]>a[j])
{ //the main logic part
temp=a[i];
a[i]=a[j];
a[j]=temp;
}
}
}
printf(“\nthe element in ascending order is:\n”);
for(i=0;i<n;i++)
printf(“\t%d”,a[i]);
printf(“\nthe highest number is %d”,a[n-1]);
printf(“\nthe lowest number is %d”,a[0]);
}
OUTPUT

In the given program first i have changed the array value in ascending order and then automatically the the first value of the array the array will be smallest and the last will be highest value.
Note:- Displaying the numbers in ascending order is extra work in my program code. There is no need of that portion.
