Posts

Showing posts from March, 2022

Program to find the smallest number in an array of 10.

  // program to find smallest no. in array #include <stdio.h> #include <conio.h> int main () {     int arr [ 5 ] = { 22 , 54 , 3 , 6 , 9 };     int lenght = sizeof ( arr ) / sizeof ( arr [ 0 ]);     int min = arr [ 0 ];     int a = sizeof ( arr );     for ( int i = 0 ; i < lenght ; i ++ )     {         if ( arr [ i ] < min )         {             min = arr [ i ];         }     }     printf ( "Smallest element present in array is %d\n" , min );     return 0 ; } // Output Smallest element present in array is 3

If age of Ram, Shyam,Ajay are input through the key board , Write a program to determine the youngest of the three.

// program youngest of three . # include <stdio.h> int main (){     int ram , shyam , ajay ;     printf ( "Enter the age of Ram ,Shyam and Ajay:\n" );     scanf ( "%d%d%d" , & ram , & shyam , & ajay );     if ( ram < shyam )     {         if ( ram < ajay )         {             printf ( "Ram is youngest" );         }     }     if ( shyam < ram )     {         if ( shyam < ajay )         {             printf ( "Shyam is youngest" );         }     }     if ( ajay < ram )     {         if ( ajay < shyam )         {             printf ( "Ajay is youngest" );         }   ...

A five digit number is entered through the keyboard . write a program to obtain the reversed number and to determine whether the original and reversed numbers are equal or not.

  /*Program for  three  Digit number check wheater the original and reverse are equal or not.*/ #include <stdio.h> int main () {     int num , n1 , n2 , n3 , rev ;     printf ( "Enter the three digit number :" );     scanf ( "%d" , & num );     n3 = num % 10 ;     num = num / 10 ;     n2 = num % 10 ;     num = num / 10 ;     n1 = num % 10 ;     num = num / 10 ;     rev = n3 * 100 + n2 * 10 + n1 * 1 ;     printf ( "Please once again enter the same number:" );     scanf ( "%d" , & num );     printf ( "\n%d" , rev );     if ( rev == num )     {         printf ( "\nThe Original number and reversed number are equal.\n" );     }     else     {         printf ( "\nThe Original number and reversed number are not equal!\n" ); ...