Sunday, December 20, 2015

Addition of vector element

#include <iostream>
#include <vector>
using namespace std;
main()
{   int s=0;
vector<int> v = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
vector <int>::iterator it;
for(it = v.begin(); it != v.end();++it)
s=s+*it;
        cout <<s;
        return 0;
}

Monday, April 8, 2013

//wap to add two no by pointer



Adding two numbers using pointer




#include<stdio.h>
#include<conio.h>
  main()
{ int a,b,*pa,*pb;
//a=10,b=20;
pa=&a;
pb=&b;
printf("input 2 no ");
scanf("%d%d",pa,pb);
printf("\n sum=%d",*pa+*pb);
getch();
}

Saturday, March 30, 2013

Program to add two no by pointer .


#include<stdio.h>
#include<conio.h>
  main()
{ int a,b,*pa,*pb;
//a=10,b=20;
pa=&a;
pb=&b;
printf("input 2 no ");
scanf("%d%d",pa,pb);
printf("\n sum=%d",*pa+*pb);
getch();
}

Friday, May 11, 2012


Filecrop.com - search and download Mediafire, Hotfile and Rapidshare files

Program to check that entered no is divisible by 5 or not.


//program to check that entered no is divisible by 5 or not.
#include<stdio.h>
#include<conio.h>
main()
{ int n,r,s,i;
 printf("Enter the no ");
 scanf("%d",&n);
 s=0;
for(i=0;i<1;i++)
 { r=n%10;
  n=n/10;
 }
 if(r==0||r==5)
 printf("Entered no is divisible by 5");
 else
 printf("Entered no is Not divisible by 5");
getch();
}

Program to count number of digits in a number.


// program to count number of digits in a number.
#include<stdio.h>
#include<conio.h>
main()
{
     int  num,count=0;
  printf("Enter a number: ");
  scanf("%d",&num);
   while(num)
  {
      num=num/10;
      count++;
  }
  printf("Total digits is:  %d",count);
getch();
}

Program to check that entered no is divisible by 9 or not.


//program to check that entered no is divisible by 9 or not.
#include<stdio.h>
#include<conio.h>
main()
{ int n,r,s;
 printf("Enter the no ");
 scanf("%d",&n);
 s=0;
 while(r!=0)
 { r=n%10;
  n=n/10;
  s=s+r;
 }
 if(s%9==0)
 printf("Entered no is divisible by 9");
 else
 printf("Entered no is Not divisible by 9");
getch();
}