Paging Related C Program:
Input : 45
Output : 10 + 10 + 10 + 10 + 5
#include
#include
void main()
{
int numberoflinksperpage=10;
int n,low,high,i=0;
clrscr();
printf("Enter number : ");
scanf("%d",&n);
while(n>numberoflinksperpage)
{
low=i;
high=i+1;
i++;
printf("\n display results from %d to %d ",numberoflinksperpage*low,numberoflinksperpage*high);
n=n-numberoflinksperpage;
}
low=i;
high=i+1;
printf("\n display results from %d to %d ",numberoflinksperpage*low,numberoflinksperpage*(high-1)+n);
getch();
}
#include
ReplyDelete#include
void main()
{
int i,j,k,n;
clrscr();
printf("Enter number : ");
scanf("%d",&n);
i=(n/100);
j=(n%100);
for(k=0;k<i;k++)
printf("10 +");
printf("%d",j);
}
Input: 77
Output: 10+10+10+10+10+10+10+7
This is simple way na!!!!!