+ 1
Write code to print following on the screen ?
1 2 3 4 5 6 7 8 9 10
5 Réponses
+ 10
Have you tried it yourself ? Could you please post your attempt ?
+ 6
Very good Lakhan Nagar
Here is your code but it can take user input:
#include <stdio.h>
int main() {
int a,i,j,k=1;
scanf("%d",&a);
for(i=1;i<=a;i++){
for(j=1;j<=i;j++){
printf("%d ",k++);
}
printf("\n");
}
return 0;
}
+ 3
It is a floyd's triangle.
https://www.sololearn.com/Discuss/1216634/?ref=app
https://www.sololearn.com/learn/4872/?ref=app
+ 2
// It is done by nested for looping.
#include<studio.h>
void main()
{
int I,j,k=1;
for(i=1;i<=4;i++)
{
for(j=1;j<=I;j++)
{
printf("%d\t",k++);
}
printf("\n");
}
}
+ 2
Yeah, you are right. It can take user's input but there no. of rows and columns will be depend on the input.