100,1,99,2,98,3...... write a C pgm to generate this series
with user input for the number of nos. to b displayed..
Answers were Sorted based on User's Feedback
Answer / soumya
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j;
clrscr();
for(i=100,j=1;i>0;i-=1,j+=1)
{
printf("%d,%d,",i,j);
}
getch();
}
Is This Answer Correct ? | 16 Yes | 4 No |
Answer / vishwaranjan kumar singh
#include<stdio.h>
#include<conio.h>
void main()
{
int i=0,j=0;
getch();
for(i=100,j=1;i>0;i--,j++)
{
printf("%d-%d-",i,j);
}
clrscr();
}
Is This Answer Correct ? | 14 Yes | 6 No |
Answer / niveditha
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,n,count=0;
printf("enter the number of no's to be displayed");
scanf("%d",&n);
for(i=100,j=1;count<n;i--,j++)
{
printf("%d,",i);
count=count+2;
if(count<=n)
printf("%d,",j);
}
getch();
}
Is This Answer Correct ? | 7 Yes | 3 No |
Answer / suren
#include<stdio.h>
void main()
{
int i,j,n,count;
printf("Enter the number of numbers to be printed\n");
scanf("%d",&n);
for(i=100,j=1,count=0;count<n;i--,j++,count++)
{
printf(" %d ",i);
if(++count>=n)
return;
printf(" %d ",j);
}
}
Is This Answer Correct ? | 4 Yes | 2 No |
Answer / gyanaranjan patra
#include<stdio.h>
void main()
{
static int a=100,i,b=1;
for (i=1;i<=100;i++)
{
printf("%d %d ",a,b);
a=a-1;
b=b+1;
}
}
// this is the simpler one try it;;;;.. ...
Is This Answer Correct ? | 4 Yes | 2 No |
Answer / manohar bharti
#include<stdioh>
#include<conio.h>
void main()
{
int i,j,k,r;
printf("Enter the no. of terms you want");
scanf("%d",&r);
for(i=100,j=1,k=0;k<r;i--,j++,k++)
{
printf("%d",i);
k++;
printf(",");
if(k<r)
{
printf("%d",j);
printf(",");
}
else
return;
}
getch();
}
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / vishwaranjan singh
#include<stdio.h>
#include<conio.h>
void main()
{
int i=0,j=0;
getch();
for(i=100,j=1;i<0;i--,j++)
{
printf("%d-%d-",i,j);
}
clrscr();
}
Is This Answer Correct ? | 4 Yes | 13 No |
can u give me the information about the questions asked by the bally in campus
What is Lease Line?Why power cord is not required to NT Boxex on which lease is connected ?Why we use use NT BOXEs for ISDN and Lease line?
Whats the difference between following two array declaration in JAVA? int a[]={1,2,3,4,5}; int []a-{1,2,3,4,5};
please tell me difference between router and cisco router
What have you done to improve or develop your knowledge / professional qualifications in the last year?
true and false 1. The jawa source code can be created in a notepad editor. 2. The value of 111% 13 is 3.
Why is not creat swap partition in my system.
Hi friends..cud any help to get QC 9.2 trial..i tried with HP site but did'nt got it..please help me out
What are the input documents to 1.Functional testing,2.System testing and 3.Integration testing. Whether there will be separate test cases for regression testing or functional testing?
1. Design a counter which counts 0, 4, 8, 2, 6, and repeats using: 1.a using JK flip flops 1.b using T flip flops 1.c using D flip flops 2. Modify your design in question 1.a so that the circuit works according to the following function table X Y F 0 0 Clear 0 1 No Change 1 0 Parallel Loading 1 1 Count 3. Design a circuit that detects the pattern 010 in a serial input X considering: 3.a Overlapping 3.b No overlapping
what is buffer solution?
how to send request to the direct server rather than proxy server