Inverted Pyramid : C Program

Computer Science » C Program » Inverted Pyramid 

Program :

#include<stdio.h>
 
int main() 
{
   int i, j;
   char ch = '*';
 
   for (i = 4; i >= 0; i--) 
   {
      printf("n");
      for (j = 0; j < i; j++)
         printf("%c", ch);
   }
   return(0);
}

Output :

****
***
**
*
Subject Name : Computer Science
Exam Name : IIT GATE, UPSC ESE, RRB, SSC, DMRC, NMRC, BSNL, DRDO, ISRO, BARC, NIELIT
Posts Name : Assistant Engineer, Management Trainee, Junior Engineer, Technical Assistant
Computer Science Books

GATE 2023 Total InfoENGG DIPLOMAUGC NET Total Info
IES 2023 Total InfoPSUs 2022 Total InfoCSIR UGC NET Total Info
JAM 2023 Total InfoM TECH 2023 Total InfoRAILWAY 2022 Total Info

Related Posts

  • 1-10 Numbers in Pyramid : C ProgramComputer Science » C Program » 1-10 Numbers in Pyramid Program : [php]#include<stdio.h> int main() { int i, j; int count = 1; for (i = 0; i <= 4; i++) { printf("n"); for (j = 0; j < i; j++) { printf("%dt", count); count++; } } return(0); }[/php] Output : [php]1 2 3 4 5 6 7 8 9 10 [/php]
    Tags: program, pyramid, computer, science, output, programs
  • Even Number Pyramid : C ProgramComputer Science » C Program » Even Number Pyramid Program : [php]#include&lt;stdio.h&gt; int main() { int i, j, num = 2; for (i = 0; i &lt; 4; i++) { num = 2; for (j = 0; j &lt;= i; j++) { printf(&quot;%dt&quot;, num); num = num + 2; } printf(&quot;n&quot;); } return (0); }[/php] Output : [php]2 2 4 2 4 6 2 4 6 8 [/php]
    Tags: program, pyramid, computer, science, output, programs
  • Find the Simple Interest : C ProgramComputer Science » C Program » Find the Simple Interest Program : [php]#include<stdio.h> int main() { int amount, rate, time, si; printf("nEnter Principal Amount : "); scanf("%d", &amount); printf("nEnter Rate of Interest : "); scanf("%d", &rate); printf("nEnter Period of Time : "); scanf("%d", &time); si = (amount * rate * time) / 100; printf("nSimple Interest : %d", si); return(0); }[/php] Output : [php]Enter Principal Amount : 100 Enter Rate of Interest : 5 Enter Period of Time : 2 Simple Interest : 10[/php]
    Tags: program, computer, science, output, programs
  • Find Sum of Digits of a Number : C ProgramComputer Science » C Program » Find Sum of Digits of a Number Program : [php]#include <stdio.h> int main() { long number, digit, sum = 0; printf("Enter the number :"); scanf("%ld", &number); while (number > 0) { digit = number % 10; sum = sum + digit; number = number / 10; } printf("nSum of the digits of given number is : %ld", sum); }[/php] Output : [php]Enter the number : 2882 Sum of the digits of given number is : 20[/php]
    Tags: program, computer, science, output, programs
  • Binary Numbers Pyramid : C ProgramComputer Science » C Program » Binary Numbers Pyramid  Program : [php]#include<stdio.h> int main() { int i, j; int count = 1; for (i = 1; i <= 5; i++) { printf("n"); for (j = 1; j <= i; j++) { printf("%d", count % 2); count++; } if (i % 2 == 0) count = 1; else count = 0; } return(0); }[/php] Output : [php]1 01 101 0101 10101[/php]
    Tags: program, pyramid, computer, science, output, programs

LEAVE A REPLY

Please enter your comment!
Please enter your name here