Posts

Showing posts from May, 2022

5 h.) Program to print:-

  /*program to print the 5 44 333 2222 11111*/ #include <stdio.h> #include <conio.h> int main () {     int i , j ;     for ( i = 5 ; i > 0 ; i --)     {         for ( j = 0 ; j <= 5 - i ; j ++)         {             printf ( " %d " , i );         }         printf ( " \n " );     }     return 0 ; } Output:- 5 44 333 2222 11111 ***** Thank you ******

5g.) program to print:-

  /*program to print the 5 54 543 5432 54321*/ #include <stdio.h> #include <conio.h> int main () {     int i , j ;     for ( i = 0 ; i < 5 ; i ++)     {         for ( j = 5 ; j >= 5 - i ; j --)         {             printf ( " %d " , j );         }         printf ( " \n " );     }     return 0 ; } Output:- 5 54 543 5432 54321 **** Thank You *****

5 f.) Program to print

  /*program to print the 1 01 101 0101 10101*/ #include <stdio.h> #include <conio.h> int main () {     int i,j,n= 1 ;     for (i= 1 ;i<= 5 ;i++)     {         for (j= 1 ;j<=i;j++)         {             if ((i+j)% 2 == 0 )             {                 printf ( "1" );             }             else             {                 printf ( "0" );             }         }         printf ( " \n " );     }     return 0 ; } Output:- 1 01 101 0101 10101 ***** Thank you ******

5 e.) Program to print :-

  /*program to print the 2 34 456 5678 678910*/ #include <stdio.h> #include <conio.h> int main () {     int i , j , n = 1 ;     for ( i = 1 ; i <= 5 ; i ++)     {         for ( j = 1 ; j <= i ; j ++)         {             printf ( " %d " , i + j );         }         printf ( " \n " );     }     return 0 ; } Output:- 2 34 456 5678 678910 ***** Thank you 😃***

5 d.) program to print this :

  /*program to print the 1 23 456 78910 1112131415*/ #include <stdio.h> #include <conio.h> int main () {     int i , j , n = 1 ;     for ( i = 1 ; i <= 5 ; i ++)     {         for ( j = 1 ; j <= i ; j ++)         {             printf ( " %d " , n );             n = n + 1 ;         }         printf ( " \n " );     }     return 0 ; } Output :- 1 23 456 78910 1112131415 ******* Thank you *******

5 c.) Program to print this :

  /* program to print the : 1 12 123 1234 12345*/ #include <stdio.h> #include <conio.h> int main () {     int i , j ;     for ( i = 1 ; i <= 5 ; i ++) // this loop use for lines.     {         for ( j = 1 ; j <= i ; j ++) // this loop is use for print the number.         {             printf ( " %d " , j );         }         printf ( " \a\n " );     }     return 0 ; } Output: 1 12 123 1234 12345 ***** Thank you *****

5b-) WAP to print following outputs: ##### ....... #### ....... ### ...... ## ...... #

  /* program to print : ##### #### ### ## # */ #include <stdio.h> #include <conio.h> int main () {     int i ; int j ;     for ( i = 5 ; i > 0 ; i --)     {         for ( j = 5 ; j > 5 - i ; j --)         {             printf ( "#" );         }         printf ( " \n " );     }     return 0 ; } Output:- ##### #### ### ## # **** Thank you ****

5a-)WAP to print following outputs: 1 ....2 2 ..... 3 3 3 ....... 4 4 4 4 ....... 5 5 5 5 5 .

  /*Program to print   1   22   333   4444   55555*/   #include <stdio.h>   #include <conio.h>   int main ()   {       int i , j ;       for ( i = 1 ; i <= 5 ; i ++)       {           for ( j = 1 ; j <= i ; j ++)           {               printf ( " %d " , i );           }           printf ( " \n " );       }       return 0 ;   }      Output:- 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 ****** Thank you *****

4.) Program to print the square of given range of numbers.

// Program to print the square of given range of numbers. #include <stdio.h> #include <conio.h> #include <math.h> int main () {     int beg , end , i , sq ;     printf ( "Enter the range you can find the square of the number: \n " );     scanf ( " %d%d " , & beg , & end );     for ( i = beg ; i <= end ; i ++)     {         sq = pow ( i , 2 );         printf ( "square of %d is %d \n " , i , sq );     }     return 0 ; } Output: Enter the range you can find the square of the number: 5 10 square of 5 is 25 square of 6 is 36 square of 7 is 49 square of 8 is 64 square of 9 is 81 ***** Thank You ***** any doubt please comment .

3.) PROGRAM TO CHECK THE TRIANGLE IS ISOSCELES, EQUILATERAL, SCANLENE ACCORDING THIER SIDES.

  // Q3. PROGRAM TO CHECK THE TRIANGLE IS ISOSCELES, EQUILATERAL, SCANLENE ACCORDING THIER SIDES. #include <stdio.h> #include <conio.h> int main () {     int s1 , s2 , s3 ;     printf ( "Enter the sides of the triangle : \n " );     scanf ( " %d%d%d " , & s1 , & s2 , & s3 );     if (( s1 == s2 && s2 != s3 ) || ( s2 == s3 && s3 != s1 ) || ( s3 == s1 && s1 != s2 ))     {         printf ( "side of the triangle is %d , %d , %d is an Isosceles Triangle \n " , s1 , s2 , s3 );     }     if ( s1 == s2 && s2 == s3 && s3 == s1 )     {         printf ( "side of the triangle is %d , %d , %d is an Equilateral Triangle \n " , s1 , s2 , s3 );     }     if ( s1 != s2 && s2 != s3 && s3 != s1 )     {     ...

2.) Program to check the character is upper case or lower case. : )

  // program to check the character is uppercase or lower case. #include <stdio.h> int main () {     char ch ;     printf ( "Enter the character lower as well upper case: \n " );     scanf ( " %c " , & ch );     if ( ch >= 65 && ch <= 90 )     {         printf ( " %c is the upper case character" , ch );     }     else if ( ch >= 97 && ch <= 122 )     {         printf ( " %c is the lower case character" , ch );     }     return 0 ; } Output: Enter the character lower as well upper case: Z Z is the upper case character. ***** THANK YOU *****

1.) Program to swap the value of three variable without using fourth variable.

  // program to swap the value of three variable without using fourth variable. #include <conio.h> #include <stdio.h> int main () {     int a , b , c ;     printf ( "Enter the value of a,b,c: \n " );     scanf ( " %d%d%d " , & a , & b , & c );     a = a + b + c ;     c = a - ( b + c );     b = a - ( b + c );     a = a - ( b + c );     printf ( "The value of a,b and c after interchange is \n a = %d , \n b = %d , \n c = %d " , a , b , c );     return 0 ; } Output: Enter the value of a,b,c: 8 9 10 The value of a,b and c after interchange is a = 9, b = 10, c = 8 ***** THANK YOU *****

Program to find the smallest number of three number.

  // program to find the smallest of three Numbers. #include <stdio.h> #include <conio.h> int main () {     float a , b , c ;     printf ( "Enter the first number : \n " );     scanf ( " %f " ,& a );     printf ( "Enter the second number : \n " );     scanf ( " %f " ,& b );     printf ( "Enter the third number : \n " );     scanf ( " %f " ,& c );     if (( a < b )&&( a < c ))     {         printf ( " %f is smallest number compare to other number \n " , a );     }     else if (( b < a )&&( b < c ))     {         printf ( " %f is smallest number compare to other number \n " , b );     }     else if (( c < a )&&( c < b ))     {         printf ( " %f is smallest number compare to other number \n " , c ); ...

program to check the given number is even or odd .

  // Program to check the given number is even or odd. #include <stdio.h> #include <conio.h> int main () {     int n ;     printf ( "Enter the number : \n " );     scanf ( " %d " , & n );     if ( n % 2 == 0 )     {         printf ( " %d is even number! \n " , n );     }     else     {         printf ( " %d is odd number! \n " , n );     }     return 0 ; } Output. Enter the number : 60 60 is even number! ****** Thank you *****

program to calculate the simple interest.

/*Program to calculate the simple interest .principal amount ,rate ,and time enter by the user.*/ #include <stdio.h> #include <conio.h> int main () {     float p , r , t , si ;     printf ( "Enter the principal amount : \n " );     scanf ( " %f " , & p );     printf ( "Enter the rate : \n " );     scanf ( " %f " , & r );     printf ( "Enter the duration of time in year: \n " );     scanf ( " %f " , & t );     si = ( p * r * t ) / 100 ;     printf ( "Simple Interest : %.2f " , si );     return 0 ; } output Enter the principal amount : 9000 Enter the rate : 3.5 Enter the duration of time in year: 2 Simple Interest :630.00 ****** Thank you ******

program to print the value ,address and size of different type of variable.

  // Program to print the value ,address ,size of different type of variable. #include <stdio.h> #include <conio.h> int main () {     int a , l , m , n ; \\size of datatype is positive integer     char b ;     float c ;     printf ( "Enter the value of a,b,c: \n " );     scanf ( " %d %c%f " , & a , & b , & c );\\ Gap for char     printf ( "Address of variable a is %u \n " , & a );     printf ( "Address of variable b is %u \n " , & b );     printf ( "Address of variable c is %u \n " , & c );     l = sizeof ( a );     m = sizeof ( b );     n = sizeof ( c );     printf ( "Size of variable a is %d \n " , l );     printf ( "Size of variable b is %d \n " , m );     printf ( "Size of variable c is %d \n " , n );     return 0 ; } Output Enter the value of a,b,c: 8 a 5.5 Address of variable a is 6...