Pages

Showing posts with label print. Show all posts
Showing posts with label print. Show all posts

Wednesday, March 11, 2015

Download or print Google docs viewer file

Today I was amazed by not being able to properly print a Google Docs Viewer file. Not sure if that was due to some protection of the document, but it was really not nice. All I got from printing was the first page. Through PDF or direct print. No "Download" button or anything like it. I assume it is due to protection levels anyway.

After few minutes, the only solution possible was:

1. Open Firefox
2. Install "downthemall"
3. Scroll through all the file so all the images render
4. Select "DownThemAll" from the blank space in the centre of the page


Got all the images to my local disk, so then just selected them all and print (now this is really good feature in Windows 7, congratulations MS).
Read more »

Tuesday, February 17, 2015

C program to read a string and print it in alphabetical order


C program to read a string and print it in alphabetical order

#include<stdio.h>
#include<conio.h>
#include<string.h>

void main()
{
int i,j,n,ch1,ch2;
char a[50],temp;
clrscr();
printf("Enter any string:");
scanf("%s",a);
n=strlen(a);

for(i=1;i<n;++i)
for(j=0;j<(n-i);++j)
{
ch1=a[j];
ch2=a[j+1];
if(ch1>ch2)
{
temp=a[j];
a[j]=a[j+1];
a[j+1]=temp;
}
}

printf("String after arranging %s",a);
getch();
}
Read more »

Saturday, February 14, 2015

C program to print first n natural numbers and their sum


#include<stdio.h>
#include<conio.h>

void main()
{
int n,i,sum=0;
clrscr(); //to clear the screen
printf("Enter the value of n:");
scanf("%d",&n);

for(i=1;i<=n;++i)
{
printf("
%d",i);

sum+=i;
}
printf("

Sum of first n natural numbers is:%d",sum);

getch(); //to stop the screen
}
Read more »

Wednesday, February 11, 2015

C Program to Print Numbers From 1 to n Without Using Loops Recursion or Goto Statement

You may have made program to print numbers from 1 to n using loops, recursion or goto statement. But have you ever thought about doing this without help of loops, recursion or goto? It can be done without using such things as explained in below program.

Also Read: C program to find factorial of any number using recursion
Also Read: C++ Templates: Program to Swap Two Numbers Using Function Template

#include<iostream>

using namespace std;

class Num
{
    public:
    static int i;
    Num()
    {
        cout<<i++<<" ";
    }
};

int Num::i=1;

int main()
{
    int n;
    cout<<"Enter value on n:";
    cin>>n;
    Num obj[n];
    return 0;
}

In this program we are using the concept of static data member and array of objects. Class Numcontains a static variable i whose value will remain till the program terminates. We are creating an array of objects of class Num. In this program we are creating n objects, value of n depends on input we give. The default constructor is called for all objects one by one. In the constructor the value of i is printed and is incremented by one in each call. In this way numbers from 1 to n are printed.

C++ Program to Print Numbers From 1 to n Without Using Loops, Recursion or Goto Statement

If you have any doubts or any suggestion regarding above program then you can ask it by commenting below.

Source: http://www.geeksforgeeks.org/output-of-c-program-set-18-3/
Read more »

C program to print fibonacci series i e 0 1 1 2 3 5 8


#include<stdio.h>
#include<conio.h>

void main()
{
int first=0,second=1,third,i,n;
clrscr();  //to clear the screen

printf("Enter how many elements?");
scanf("%d",&n);
printf("
%d %d",first,second);


for(i=2;i<n;++i)
{
third=first+second;
printf(" %d",third);
first=second;
second=third;
}
getch();  //to stop the screen
}
Read more »