Write a C Program to Generate the Following Output Without using Formatted I/O Function

In this tutorial learn how you can generate the following output without using formatted I/O function. Here we are generating with the pattern.

You need to generate the following output.

*****

  ****

    *** 

      **      

        * 

C programming is a powerful general-purpose programming language. It can be used to develop software like operating systems, databases, compilers, etc.




Write a Program to Generate the Following Output Without using Formatted I/O Function

Here is the code to generate the following output without using formatted I/O function in C programming.

#include <stdio.h>/*Generate the following output without using formatted I/O function.

*****
 ****
  *** 
   **      
    * 
                     */
int main(){
    int i,j,k;
    for (i = 1; i <= 5 ; i++)
    {
        for ( j = 1; j < i; j++)
        {
            putchar(' ');
        }
        for ( k = i; k <= 5; k++)
        {
            putchar('*');
        }
        putchar('\n');
    }
    
    return 0;
}

Test Live At Jdoodle



Conclusion

This is how you can generate the following output without using formatted I/O function in C programming. Comment below if you like our tutorial.

0 Comments