#include<stdio.h>
int main() {
char prnt = '*';
int i, j, s, nos = 0;
for (i = 9; i >= 1; (i = i - 2)) {
for (s = nos; s >= 1; s--) {
printf(" ");
}
for (j = 1; j <= i; j++) {
if ((i % 2) != 0 && (j % 2) != 0) {
printf("%2c", prnt);
} else {
printf(" ");
}
}
printf("\n");
nos++;
}
nos = 3;
for (i = 3; i <= 9; (i = i + 2)) {
for (s = nos; s >= 1; s--) {
printf(" ");
}
for (j = 1; j <= i; j++) {
if ((i % 2) != 0 && (j % 2) != 0) {
printf("%2c", prnt);
} else {
printf(" ");
}
}
nos--;
printf("\n");
}
return 0;
}
Write a function that print a triangle of stars.
write a c++ programe to print a triangle without (for)
... int i; for( i = 0; i < 7; ++i ) { printf("*"); } printf("\n"); ...
C++ has no print option. The print option in your IDE allows you to print your C++ source code, thus giving you a "hard" copy of your code.
A C-print or Type C-print is a color print from a color negative. The term "Type C" is generally used to distinguish from R or Reversal prints or direct positive prints from transparencies (color positives). Type C prints can also be made digitally. Type C is probably the most common form of color print.
printf(format_string, ...);
# include<stdio.h> main() { int a,b,c; print f("enter the values of a,b,c"); scan f("%d%d%d",&a,&b,&c); if((a>b)&&(a>c)) print f("Greatest value is a =%d",a); else if((b>a)&&(b>c)) print f("Greatest value is b=%d",b); else print f("Greatest value is c=%d",c); }
You will have to use "printf" when you want to print two slashes one after another in c.
If you wish to sum every number as you go along:10 LET A=120 PRINT A30 LET B=A+140 PRINT A+B50 LET C=B+160 PRINT A+B+C70 LET D=C+180 PRINT A+B+C+D90 LET E=D+1100 PRINT A+B+C+D+E110 LET F=E+1120 PRINT A+B+C+D+E+F130 LET G=F+1140 PRINT A+B+C+D+E+F+G150 LET H=G+1160 PRINT A+B+C+D+E+F+G+H170 LET I=H+1180 PRINT A+B+C+D+E+F+G+H+I180 LET J=I+1190 PRINT A+B+C+D+E+F+G+H+I+J200 STOP
Copyright
printf"Bhawana"
See related link for a star map