+ 1

Write code to print following on the screen ?

1 2 3 4 5 6 7 8 9 10

4th Feb 2019, 7:52 PM
Lakhan Nagar
Lakhan Nagar - avatar
5 Respuestas
+ 10
Have you tried it yourself ? Could you please post your attempt ?
4th Feb 2019, 9:08 PM
Uni
Uni - avatar
+ 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; }
6th Feb 2019, 6:02 PM
Uni
Uni - avatar
5th Feb 2019, 6:40 AM
Denise Roßberg
Denise Roßberg - avatar
+ 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"); } }
6th Feb 2019, 5:09 PM
Lakhan Nagar
Lakhan Nagar - avatar
+ 2
Yeah, you are right. It can take user's input but there no. of rows and columns will be depend on the input.
7th Feb 2019, 5:08 AM
Lakhan Nagar
Lakhan Nagar - avatar