Before seeing the solution make sure that you tried enough. Don’t paste the whole code, just find out the logic. If you stuck in trouble, just inform me on comment.
/**Bismillahir Rahmanir Rahim.**/ #include <stdio.h> int main() { int X,Y,z,a,b=0; scanf("%d%d", &X,&Y); for(a=1; a<=Y; a++) { b++; if(b==X) printf("%d",a); else printf("%d ", a); if(b==X) { b=0; printf("\n"); } } return 0; }
if(b==X)
ReplyDeleteprintf("%d",a);
else printf("%d ", a);
if(b==X)
{
b=0;
printf("\n");
}
Can I use same conditions ? Like u use if(a==x) twice.
man your code is readless
ReplyDeleteI has been tried to solve this problem . But always seems the presentation error . #include
ReplyDeleteint main()
{
int i,n,a,b=0;
scanf("%d %d",&a,&n);
for(i=1; i<=n; i++)
{
printf("%d ", i);
b++;
if(b==a)
{
printf("\n");
b=0;
}
}
return 0;
}
l
whats the problem
WHY presentation error !
ReplyDelete#include
ReplyDeleteint main()
{
int X,Y,j,i;
scanf("%d%d", &X,&Y);
if(Y>X)
for(i=1;i<=Y;i=i+X)
{
for(j=i;j<X+i;j++)
{
printf("%d ", j);
}
printf("\n");
}
return 0;
}
PRESENTATION ERROR WHY? please,,,,
This comment has been removed by the author.
ReplyDelete#include
ReplyDeleteint main()
{
int x,y,i,j=0;
scanf("%d %d",&x,&y);
for(i=1;i<=y;i++)
{
printf("%d",i);
j++;
if(j<x)
printf(" ");
else
{
printf("\n");
j=0;
}
}
return 0;
}
#include
ReplyDeleteusing namespace std;
main(){
int x,y,i,j,a;
cin >> x;
cin >> y;
if((x>1 && x<20) && (y>x) && y<100000){
for(i=1;i<=y;i++){
a=i;
for(j=1;j<=x;j++){
if(a==y){
cout << a << " ";
a++;
break;
}
else{
cout << a << " " ;
a++;
}
}
cout << endl;
i+=x-1;
}
}
}
why presentation error
#include
ReplyDeletevoid main(void){
int x, y, cont;
scanf("%i", &x);
do{
scanf("%i", &y);
}while(y <= x);
for (cont = 1;cont <= y; cont++){
if (cont % x == 0 || cont == y){
printf("%i\n", cont);
}
else{
printf("%i ", cont);
}
}
}
This comment has been removed by the author.
ReplyDelete#include
ReplyDeleteint main ()
{
int n,a,h;
scanf ("%d%d",&a,&h);
for (n=1;n<=h;n++)
{
if (n%a==0)
{
printf ("%d \n",n);
}
else
{
printf ("%d ",n);}
}
return 0;
}
What is the problem in this code can anyone help me
ReplyDelete#include
int main()
{
int i, x, y, j, c = 1;
scanf("%d %d", &x, &y);
for (i = 1; i <= y; i++)
{
for (j = 1; j <= x; j++)
{
if (c == y + 1)
{
break;
}
if (c == x)
{
printf("%d", c++);
}
else
{
printf("%d ", c++);
}
}
printf("\n");
if (c == y + 1)
{
break;
}
}
}
# include
ReplyDeleteint main ()
{
int x,y;
scanf("%d%d", &x,&y);
int i;
for (i=1; i<=y; i++)
{
if((i%x)==0)
{
printf("%d\n", i);
}
else
{
printf("%d ",i);
}
}
return 0;
}
#include
ReplyDelete#include
int main()
{
int i, s, j, k, temp=0;
scanf("%d %d", &s, &j);
for(i=1; i<=j; i++)
{
printf("%d ",i);
temp+=1;
if(temp%s==0)
{
printf("\n");
}
}
return 0;
}
why I'm getting presentation error?
ReplyDelete#include
ReplyDeleteint main()
{
int x, y, i, j, n, m;
scanf("%d%d",&x,&y);
for(i=1;i<=y;i++)
{
if(i%x==0)
{
printf("%d\n",i);
}
else
{
printf("%d ",i);
}
}
return 0;
}
very simple
ReplyDelete#include
ReplyDeleteusing namespace std;
int main() {
int x, y;
cin >> x >> y;
for (int i = 1; i <= y; i++) {
cout << i << " ";
if (i % x == 0)
cout << endl;
}
}
i got presention error