(adsbygoogle = window.adsbygoogle || []).push({});
Write a program to print following pattern
1
2 3
4 5 6
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,temp=1;
clrscr();
for(i=1;i<=3;i++)
{
for(j=1;j<=i;j++)
{
printf(" %d",temp);
temp=temp+1;
}
printf("\n");
}
getch();
}
...
C++ Program .Write a program to argument & return value
By Sachin
January 23, 2014
(adsbygoogle = window.adsbygoogle || []).push({});
#include<stdio.h>
#include<conio.h>
int add(int a,int b);
void main()
{
int a,b,ans;
clrscr();
printf("\n enter the value of a");
scanf("\n %d",&a);
printf("\n enter the value of b");
scanf("\n %d",&b);
ans=add(a,b);
printf("\n addition is n%d",ans);
getch();
}
int add(int a1,int b1)
{
int c;
c=a1+b1;
return...
C++ Program .Write a program to function with no argument & no return value.
By Sachin
January 23, 2014
(adsbygoogle = window.adsbygoogle || []).push({});
#include<stdio.h>
#include<conio.h>
void add();
void main()
{
clrscr();
add();
getch();
}
void add()
{
int a,b,c;
printf("\n enter the value of a");
scanf("\n %d",&a);
printf("\n enter the value of b");
scanf("\n %d",&b);
c=a+b;
printf("\n addition is %d",c);
...
C++ Program .Write a program to print one to ten (n) numbers using for loop.
By Sachin
January 23, 2014
(adsbygoogle = window.adsbygoogle || []).push({});
#include<stdio.h>
#include<conio.h>
void main()
{
int num,i=1;
clrscr();
printf("\n enter the number");
scanf("\n %d",&num);
for(i=1;i<=num;i++)
{
printf("\n %d",i);
}
getch();
...
C++ Program .Write a program to determine sum of first n number using for loop.
By Sachin
January 23, 2014
(adsbygoogle = window.adsbygoogle || []).push({});
#include<stdio.h>
#include<conio.h>
void main()
{
int i,n,sum=0;
clrscr();
printf("\n enter the number");
scanf("\n %d",&n);
for(i=1;i<=n;i++)
{
sum=sum+i;
}
printf("\n the sum is %d",sum);
getch();
...
C++ Program .Write a program to check given number is perfect or not using nested if..else.
By Sachin
January 23, 2014
(adsbygoogle = window.adsbygoogle || []).push({});
#include<stdio.h>
#include<conio.h>
void main()
{
int num,i,sum=0;
clrscr();
printf("\n enter the number");
scanf("\n %d",&num);
for(i=1;i<num;i++)
{
if(num%i==0)
{
sum=sum+i;
}
}
if(num==sum)
{
printf("\n number is perfect");
}
else
{
printf("\n...
C++ Program .Write a program to call by value parameter are passed by using value.
By Sachin
January 23, 2014
(adsbygoogle = window.adsbygoogle || []).push({});
#include<stdio.h>
#include<conio.h>
void swap(int a,int b);
void main()
{
int a,b;
clrscr();
printf("\n enter the value of a");
scanf("\n %d",&a);
printf("\n enter the value of b");
scanf("\n %d",&b);
swap(a,b);
getch();
}
void swap(int a1,int b1)
{
int temp;
temp=a1;
a1=b1;
b1=temp;
printf("\n swapped...
C++ Program .Write a program to call by reference.
By Sachin
January 23, 2014
(adsbygoogle = window.adsbygoogle || []).push({});
#include<stdio.h>
#include<conio.h>
void swap(int *a,int *b);
void main()
{
int a,b;
clrscr();
printf("\n enter the value of a");
scanf("\n %d",&a);
printf("\n Enter the value of b");
scanf("\n %d",&b);
swap(&a,&b);
getch();
}
void swap(int *a1,int *b1)
{
int temp;
temp=*a1;
*a1=*b1;
*b1=temp;
printf("\n...
C++ Program .Write a program to accept integer number & display it’s sum of digit.
By Sachin
January 22, 2014
(adsbygoogle = window.adsbygoogle || []).push({});
#include<stdio.h>
#include<conio.h>
void main()
{
int num,rem,sum=0;
clrscr();
printf("\n enter the number");
scanf("\n %d",&num);
while(num>0)
{
rem=num%10;
sum=sum+rem;
num=num/10;
}
printf("\n sum is %d",sum);
getch();
...
C++ Program .Write a program to input an integer number & cheack number is palindrom or not.
By Sachin
January 22, 2014
(adsbygoogle = window.adsbygoogle || []).push({});
#include<stdio.h>
#include<conio.h>
void main()
{
int num,rem,temp,sum=0;
clrscr();
printf("\n enter the value of num");
scanf("\n %d",&num);
temp=num;
while(num>0)
{
rem=num%10;
sum=rem+(sum+10);
num=num/10;
}
if(temp==num)
{
printf("\n number is palindrome");
}
else
{
printf("\n number is not...
C++ Program .Write a program to input integer number & cheack number is armstrong or not.
By Sachin
January 22, 2014
(adsbygoogle = window.adsbygoogle || []).push({});
#include<stdio.h>
#include<conio.h>
void main()
{
int num,rem,temp,sum=0;
clrscr();
printf("\n enter the number");
scanf("\n %d",&num);
temp=num;
while(num>0)
{
rem=num%10;
sum=sum+(rem*rem*rem);
num=num/10;
}
if(temp==num)
{
printf("\n number is armstrong");
}
else
{
printf("\n number is not...
C++ Program .Write a program to accept ineger number & display it’s reverse number
By Sachin
January 22, 2014
(adsbygoogle = window.adsbygoogle || []).push({});
#include<stdio.h>
#include<conio.h>
void main()
{
int num,rem;
clrscr();
printf("\n enter the number");
scanf("\n %d",&num);
do
{
rem=num%10;
printf("\n %d",rem);
num=num/10;
}
while(num>0);
getch();
...
C++ Program .Write a program to convert given character into uppercase &vice versa.
By Sachin
January 22, 2014
(adsbygoogle = window.adsbygoogle || []).push({});
#include<stdio.h>
#include<conio.h>
void main()
{
char ch,ans;
clrscr();
printf("\n enter the character");
scanf("\n %c",&ch);
if(ch>=65 && ch<=90)
{
ans=ch+32;
printf("\n lowercase character is %c",ans);
}
if(ch>=97 && ch<=122)
{
ans=ch-32;
...
C++ Program .Write a program to case.
By Sachin
January 22, 2014
#include<stdio.h>
#include<conio.h>
void main()
{
int ch;
clrscr();
printf("\n enter the character");
scanf("\n %c",&ch);
switch(ch)
{
case 1:
printf("\n
you are in choice 1");
break;
case 2:
printf("\n
you are in choice 2");
break;
case 3:
printf("\n
you are in choice 3");
...
C++ Program .Write a program to cheack wether number is even or odd using conditional operator.
By Sachin
January 22, 2014
(adsbygoogle = window.adsbygoogle || []).push({});
#include<stdio.h>
#include<conio.h>
void main()
{
int num,temp;
clrscr();
printf("\n enter the number");
scanf("\n %d",&num);
temp=((num%2==0)?0:1);
if(temp==0)
{
printf("\n number is even");
}
else
{
printf("\n number is odd");
}
getch();
...
C++ Program .Write a program to cheack whether given character is uppercase letter,lower case & digit.
By Sachin
January 22, 2014
(adsbygoogle = window.adsbygoogle || []).push({});
#include<stdio.h>
#include<conio.h>
void main()
{
char ch;
clrscr();
printf("\n enter the character");
scanf("\n %c",&ch);
if(ch>=65 && ch<=97)
{
printf("\n character is uppercase");
}
if(ch>=97 && ch<=122)
{
printf("\n character is lowercase");
...
C++ Program .Write a program to accept a character & display next & previus ascii value.
By Sachin
January 22, 2014
(adsbygoogle = window.adsbygoogle || []).push({});
#include<stdio.h>
#include<conio.h>
void main()
{
char ch;
clrscr();
printf("\n enter the character");
scanf("\n %c",&ch);
printf("\n the ascii value of character %d",ch);
printf("\n the next value of character is %d",ch+1);
printf("\n the previous ascii value character
is %d",ch-1);
getch();
...
C++ Program .Write a program to display 1 to 5 number using while condition.
By Sachin
January 22, 2014
(adsbygoogle = window.adsbygoogle || []).push({});
#include<stdio.h>
#include<conio.h>
void main()
{
int i;
clrscr();
i=1;
while(i<=5)
{
printf("\n %d",i);
i=i+1;
}
getch();
...
C++ Program .Write a program to cheack greater number in three number.
By Sachin
January 22, 2014
(adsbygoogle = window.adsbygoogle || []).push({});
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,c;
clrscr();
printf("\n enter the value of a");
scanf("\n %d",&a);
printf("\n enter the value of b");
scanf("\n %d",&b);
printf("\n enter the value of c");
scanf("\n %d",&c);
if(a>b&&a>c)
{
printf("\n a is grater");
}
else
{
printf("\n...