I loved doing this exercise and yes, there was a lot of mistakes and hit and trials! But my program is slightly different than yours but the logic is same. I have also used two for functions but my one for is in the switch statements while the other for is in the function that prints the '*'. I also used 0 for straight triangle and 1 for reversed triangle!😋😀😁
#include #include void Triangular_Pattern(int Row, int pattern); int Choose_Pattern(); int main(int argc, char const *argv[]) { int num, Pattern; // while (1) //{ printf("Enter the Row of Triangular You want to print: "); scanf("%d", &num); Pattern = Choose_Pattern(); Triangular_Pattern(num, Pattern); //} getch(); return 0; } int Choose_Pattern() { int number; printf("-------> Select The Pattern You want to Display
#include int Take_number(int number_of_star) { int num; if (number_of_star == 1) { printf("Kindly enter a number "); scanf("%d", &num); for (int i = 0; i < num; i++) { for (int j = 0; j < i + 1; j++) { printf("%c", '*'); } printf(" "); } } else if (number_of_star == 2) { printf("Kindly enter a number "); scanf("%d", &num); for (int i = num; i > 0; i--) { for (int j = i; j > 0; j--) { printf("%c", '*'); } printf(" "); } } } int main() { int num; printf("Plez enter 1 to get tringular star patern & "); printf("Enter 2 to get reversed-tringular star patern "); scanf("%d", &num); Take_number(num); return 0; }
Sir, please make a playlist on blogging. thanks sir you make awesome videos you are the only one to whom i have subscribed i just love your videos sir.
we have choose in last phase if - else if statement #include void starpattern(int rows) { for (int i = 0; i < rows; i++) { // write star for (int j = 0; j
Sir star and reverse star print karna he tho hame main function me starpattern(rows ) and reversestarpattern(rows) declared karna padega na aap ne nahi kiya kase
Oh you mean, when you enter another number than 0 and 1 then it skips the lines am I right?! It will good to put one "else" part and statement wil be ("invalid number ") in main function Like If(for 1) else if (for 0) else Hope u got it 🤨
Bhai mera laptop karab ho gya he isliye me inte din coading nhai kar pa rha ho aur me android bhi kar na chata ho which is best laptop that suits me in budget of 40 to 45 k
bhai agar game nahi khelne and bas programming ke lye chaheye toh koe sa bhe lelo HP, Dell etc but ye dekhna ki uske battery achi ho taki bar bar charge na krna pde , RAM 8GB ho Taki vo havy Software support kr le for more refernce go through Aman Dhattarwal's video
Please guide me .. i button dabane pe mera sirf output open ho raha hai. Terminal open nahi hota. Please guide me for opening terminal with i button 🙏🏻
int main() { int n; printf("number of rows you want = "); scanf("%d", &n); char option; printf(" which one the patterns you want to print? a) Triangular pattern (of n number of stars in the longest line) b) Reversed Triangular Pattern (of n number of stars in the longest line) Option : "); scanf(" %c", &option); switch (option) { case 'a': for (int i = 1; i
#include int main() { int i, j, n, choice; printf("Enter 0 for star pattern "); printf("Enter 1 for reverse star pattern "); printf("Enter the choice "); scanf("%d", &choice); printf("Enter the number of rows of given pattern "); scanf("%d", &n); if (choice == 0) { for (i = 1; i
#include void main() { int n; int a; printf("0 to print triangular star pattern 1 to print reverse triangular star pattern "); scanf("%d", &n); printf("How many lines of stars "); scanf("%d", &a); if (a > 0) { if (n == 0) { for (int i = 0; i < a; i++) { for (int j = 0; j 0; k--) { printf("*"); } printf(" "); } } }else{ printf("Error stars should be > 0 "); } }
//Program to print the star pattern as shown below: /* * ** *** **** and **** *** ** * */ /* #include int main() { int no_of_lines,i,j; char choice; printf("Enter your choice:
1. Triangular 2. Reverse Triangular Q. To quit
"); scanf("%c", &choice); switch(choice) { case '1': printf("Enter the no. of lines you want in pattern:
#include void star(int a); int main() { int a; printf("enter your row "); scanf("%d",&a); star(a); return 0; } void star(int a) { for(int i=a;i>0;i--) { for(int j=i;j>0;j--) { printf("*"); } printf(" "); } } Ek dam alag banaya bhya ea dev c me ea bolta hai virus code run nehi horaha hai
IS THIS METHOD CORRECT ? #include int printstar(int n){ for ( int i = 0; i < n; i++) {
printf("%c",'*'); } return 0;
} int main(int argc, char const *argv[]) { int n,i,m; char c; printf("enter 0 for forward triangle and 1 for reverse "); scanf("%d",&m);
switch (m) { case 0: printf("enter the no. of rows you want in your star triangle "); scanf("%d",&n); for (int i = 1; i < n; i++) { printf("%c ",printstar(i)); } break; case 1: printf("enter the no. of rows you want in your star triangle "); scanf("%d",&n); for (int i = n; i > 0;i--) { printf("%c ",printstar(i));
#include int main() { while(1){ int choice,n; printf("0.Star pattern. "); printf("1. Reverse star pattern. "); printf("2. Exit. "); printf("Enter choice. "); scanf("%d",&choice); if(choice==0){ printf("Enter how many rows you want to see. "); scanf("%d",&n); for(int i=1;i
#include int main() { int user_input; printf("Enter the 0 for Pyramid and 1 for reverse Pyramid:"); scanf("%d", &user_input); switch (user_input) { case 0: if (user_input == 0) { int n; printf("Enter the size of the pattern:"); scanf("%d", &n); for (int i = 0; i i; j--) { printf("%c", '*'); } printf(" "); } } default: printf("Thanks for using the code :>"); break;
return 0; } printf(" "); printf("Thanks for using the code :>"); }
I like this exercise so much and I enjoy it more than other exercise it tricky but more interesting😀😍
I loved doing this exercise and yes, there was a lot of mistakes and hit and trials! But my program is slightly different than yours but the logic is same. I have also used two for functions but my one for is in the switch statements while the other for is in the function that prints the '*'. I also used 0 for straight triangle and 1 for reversed triangle!😋😀😁
#include
#include
void Triangular_Pattern(int Row, int pattern);
int Choose_Pattern();
int main(int argc, char const *argv[])
{
int num, Pattern;
// while (1)
//{
printf("Enter the Row of Triangular You want to print: ");
scanf("%d", &num);
Pattern = Choose_Pattern();
Triangular_Pattern(num, Pattern);
//}
getch();
return 0;
}
int Choose_Pattern()
{
int number;
printf("-------> Select The Pattern You want to Display
jayda dimag lega diya bha tune to
#include
int Take_number(int number_of_star)
{
int num;
if (number_of_star == 1)
{
printf("Kindly enter a number
");
scanf("%d", &num);
for (int i = 0; i < num; i++)
{
for (int j = 0; j < i + 1; j++)
{
printf("%c", '*');
}
printf("
");
}
}
else if (number_of_star == 2)
{
printf("Kindly enter a number
");
scanf("%d", &num);
for (int i = num; i > 0; i--)
{
for (int j = i; j > 0; j--)
{
printf("%c", '*');
}
printf("
");
}
}
}
int main()
{
int num;
printf("Plez enter 1 to get tringular star patern &
");
printf("Enter 2 to get reversed-tringular star patern
");
scanf("%d", &num);
Take_number(num);
return 0;
}
@@kushagra9401 mene bhi same esa hi benaya hai
its working
that's really cool!! LIKE this course.
awesome sir , i really loved the way you teached
Thank U So Much Sir Aap Best Ho
Very easily understanding ❤️❤️🔥
Its really understandable thank you sir
#include
void pattern(int rows)
{
for (int i = 0; i < rows; i++)//it will display rows you want to add
{
for (int j = 0; j
Sir,
please make a playlist on blogging.
thanks sir you make awesome videos you are the only one to whom i have subscribed i just love your videos sir.
9:58 noice one
jo kayi saalon baad is course ko dekh rahe hain vo too katayi pehle insaan nahi ban sakte solve karne vaale 😂😅
#include
int main() {
int a,b;
printf("Enter 0. for triangular pattern
1. for reversed triangular pattern:
");
scanf("%d", &a);
switch(a)
{ case 0:
{ printf("In how many rows you want to print:
");
scanf("%d", &b);
for(int i = 1; i
No one:
Literally no one:
Harry: Maine hi likha hai code ,copy kar sakta hun XD
Glad to make it up to here... Forever grateful.. Thank you..
Bhai thank you for this Awesome series
Dil se dhanyabaaad 😁
Great Sir........!
Thanks
Love you sir
1:33 good word
Thanks Harry Bhaiya
Bestcoder
hello harry bhai thanku so much .......
Sir, aap reverse triangular star pattern me condition ( j
Good job sir
Done bro
we have choose in last phase if - else if statement
#include
void starpattern(int rows)
{
for (int i = 0; i < rows; i++)
{
// write star
for (int j = 0; j
I like this exercise....I enjoy..
Thank u sir 🥰
Thank you so much sir
Nice bro
Great job sir
Best courses!
😍😍😍 thanaks you harry bro
code for print sta
#include
void starpattern(int row)
{
for (int i = row; i > 0; i--)
{
for (int j = 0; j
How can we use recursion for this?
Main ek cheez nehi samjha...ki agar i less than rows hain...to user rows mein agar 5 dega to i ki maximum value to 4 pe aake ruk jaygi na?
hm
jayegi
Haa..u ar ryt..same cheek mujhe b nh samagh aa rh h..??
Shayad cha 5 hi hoga..
it's helpfull for me
जब मेने playlist dekhi तो बड़ी लगी पर अब में यह huu or pata bhi nahi चला
Nice video sir
You didn't call starpattern() in main function and you call reverse starpattern in main function but still starpattern is printing
sir is pattern se happy birthday celebrate wala program bhe bana sakte hai
great
Sir after writting the whole code as it is a lot of stars flowing with no pattern Can you plz suggest what might be error?
दूसरी बस्ते ज्यादा बोली ,लेकिन दो फॉर loop की जरूरत ही क्या थी
Aapne konsi theme laga rakhi hain
Sir star and reverse star print karna he tho hame main function me starpattern(rows ) and reversestarpattern(rows) declared karna padega na aap ne nahi kiya kase
Watching this solution me like - ye bhadiya tha guru 😅👍
sir please tell us the code of pythagoras triangle
10:00
Yaar function copy kyu kar rahe ho
Harry- mera function hai mai copy kar sakta hu
This was funny 😂😂
karo na koi kuch bola he ka ha vai
#include
void pattern_1(int rows)
{
for (int i = 0; i < rows; i++)
{
for (int j = 0; j
I like it this
But I have one problem i.e when we enter neither 0 nor 1 then it print next line after that it writing default line😢
Oh you mean, when you enter another number than 0 and 1 then it skips the lines am I right?!
It will good to put one "else" part and statement wil be ("invalid number ") in main function
Like
If(for 1)
else if (for 0)
else
Hope u got it 🤨
solve to mai bhi nhi kr paya ye Exercise 😤 bs thoda sa nhi soch paya banki almost bn gya tha!!!
sir mera vsc jab infinite loop me chala jata hai to us terminal ko kill krte ke baad ap crash ho jata hai help sir
#include
using namespace std;
void starPattern(int rows)
{
for (int i = 0; i < rows; i++)
{
for (int j = 0; j
solved ..
Done
#include
int main()
{
int i, j, ch;
printf("Enter 1 for triangle and 2 for revcerse triangle : ");
scanf("%d", &ch);
if (ch == 1)
{
for (i = 0; i
Bhai mera laptop karab ho gya he isliye me inte din coading nhai kar pa rha ho aur me android bhi kar na chata ho which is best laptop that suits me in budget of 40 to 45 k
bhai agar game nahi khelne and bas programming ke lye chaheye toh koe sa bhe lelo HP, Dell etc but ye dekhna ki uske battery achi ho taki bar bar charge na krna pde , RAM 8GB ho Taki vo havy Software support kr le for more refernce go through Aman Dhattarwal's video
Please guide me ..
i button dabane pe mera sirf output open ho raha hai. Terminal open nahi hota. Please guide me for opening terminal with i button 🙏🏻
hai mera naam nahi liya maine bhi kiya hai hua hai waha pr code but mera nahi hai? :/
i use i-- - in reverse print not i++
sir this program not run at dev c ++
show c99 or c11 mode I don't know what is this
int main()
{
int n;
printf("number of rows you want = ");
scanf("%d", &n);
char option;
printf("
which one the patterns you want to print?
a) Triangular pattern (of n number of stars in the longest line)
b) Reversed Triangular Pattern (of n number of stars in the longest line)
Option : ");
scanf(" %c", &option);
switch (option)
{
case 'a':
for (int i = 1; i
Sir screan clean dikhai nahi deraha h
Didi ke phone ke youtube ka 144p Op 🥴
But star 5 baar ya 4 baar kaise print ho rhe hai
Sheikh Soaib
anubhav singh bassi
maine apne wale se apka match karwaya lekin mujhe pahle star phir rev star pattern mil raha.pata nahi kyu?
Nhi samjh aa raha, I am a beginner.
Naresh technology ki or simple h is se star wali video..
thank me later
i aur j ko kahi par declare nahi kiya harry vai apne uske bare me batado please 🙂
bhai vs code mai automatic declare karta hai loops ke liye
hey why did he use Void there any idea ?
You can just use int but add return 0 at last
Best progarm for printing stars
#include
void starpattern(n){
for (int i = 0; i < n; i++)
{
for (int j = 0; j
3rd
#include
int main()
{
int i, j, n, choice;
printf("Enter 0 for star pattern
");
printf("Enter 1 for reverse star pattern
");
printf("Enter the choice
");
scanf("%d", &choice);
printf("Enter the number of rows of given pattern
");
scanf("%d", &n);
if (choice == 0)
{
for (i = 1; i
👏👏
Challenge accepted 😘
maine same likha par output mai error aa raha hai ki i is not declare please tell me what to do now,anyone??
#include
void main()
{
int n;
int a;
printf("0 to print triangular star pattern
1 to print reverse triangular star pattern
");
scanf("%d", &n);
printf("How many lines of stars
");
scanf("%d", &a);
if (a > 0)
{
if (n == 0)
{
for (int i = 0; i < a; i++)
{
for (int j = 0; j 0; k--)
{
printf("*");
}
printf("
");
}
}
}else{
printf("Error stars should be > 0
");
}
}
THX HARRY BRO 😍🥰
I USE GOTO ALSO;
#include
void printstar(int rows)
{
for (int i = 0; i < rows; i++)
{
for (int j = 0; j
Mene likha h wo function me copy kr skta hu😅😅
Bhai c mein interest nahi AA raha
Watch motivational videos
Chaturai 😂😂😂
#include
/* triangular star pattern
*
**
***
****
and reversed star traingular pattern]
****
***
**
*
*/
void dot(int n)
{
for (int i = 0; i
My code is written below
#include
#include
void starpattern(int rows)
{
for( int i=0;i
//Program to print the star pattern as shown below:
/*
*
**
***
****
and
****
***
**
*
*/
/*
#include
int main()
{
int no_of_lines,i,j;
char choice;
printf("Enter your choice:
1. Triangular 2. Reverse Triangular Q. To quit
");
scanf("%c", &choice);
switch(choice)
{
case '1':
printf("Enter the no. of lines you want in pattern:
");
scanf("%d", &no_of_lines);
printf("
");
for(i=1;i
Challenge accept
भाऊ जामत नहीं आहे coding कही सांगा
helo bhai sun to la
Bahut bore Karta h yaar
akshay mugalpara
#include
void star(int a);
int main()
{
int a;
printf("enter your row
");
scanf("%d",&a);
star(a);
return 0;
}
void star(int a)
{
for(int i=a;i>0;i--)
{
for(int j=i;j>0;j--)
{
printf("*");
}
printf("
");
}
}
Ek dam alag banaya bhya ea dev c me ea bolta hai virus code run nehi horaha hai
1$t
#include
void tsp(int n){
int i,j;
printf("
Triangular Star Pattern...
");
printf("
");
for(i=1;i
#include
int main()
{
for (;;)
{
int b;
printf("
");
printf("triangular star pattern - 0
");
printf("reverse triangular star pattern - 1
");
printf("quit - 3
");
scanf("%d", &b);
if (b == 0)
{
int n;
printf("no of triangle lines you wanted ?
");
scanf("%d", &n);
for (int i = 0; i < n + 1; i++)
{
printf("
");
for (int j = 0; j < i; j++)
{
printf("* ");
}
}
}
else if (b == 1)
{
int n;
printf("no of triangle lines you wanted ?
");
scanf("%d", &n);
for (int i = n ; i > 0; i--)
{
printf("
");
for (int j = 0; j < i; j++)
{
printf("* ");
}
}
}
else if (b==3)
{
break;
}
}
return 0;
}
IS THIS METHOD CORRECT ?
#include
int printstar(int n){
for ( int i = 0; i < n; i++)
{
printf("%c",'*');
}
return 0;
}
int main(int argc, char const *argv[])
{
int n,i,m;
char c;
printf("enter 0 for forward triangle and 1 for reverse
");
scanf("%d",&m);
switch (m)
{
case 0:
printf("enter the no. of rows you want in your star triangle
");
scanf("%d",&n);
for (int i = 1; i < n; i++)
{
printf("%c
",printstar(i));
}
break;
case 1:
printf("enter the no. of rows you want in your star triangle
");
scanf("%d",&n);
for (int i = n; i > 0;i--)
{
printf("%c
",printstar(i));
}
break;
}
return 0;
}
#include
void StarPattern(int rows)
{
printf("Enter the number of rows you want to print.
");
scanf("%d", &rows);
for ( int i = 0; i
#include
int main()
{
while(1){
int choice,n;
printf("0.Star pattern.
");
printf("1. Reverse star pattern.
");
printf("2. Exit.
");
printf("Enter choice.
");
scanf("%d",&choice);
if(choice==0){
printf("Enter how many rows you want to see.
");
scanf("%d",&n);
for(int i=1;i
#include
int main()
{
int user_input;
printf("Enter the 0 for Pyramid and 1 for reverse Pyramid:");
scanf("%d", &user_input);
switch (user_input)
{
case 0:
if (user_input == 0)
{
int n;
printf("Enter the size of the pattern:");
scanf("%d", &n);
for (int i = 0; i i; j--)
{
printf("%c", '*');
}
printf("
");
}
}
default:
printf("Thanks for using the code :>");
break;
return 0;
}
printf("
");
printf("Thanks for using the code :>");
}
Can you please correct my code ??
#include
void star(int n){
int i,j;
for(int i=1;i