By admin, on June 12th, 2009%
C Language Logical Questions
1. Write a program to print ‘Hello’ without using semicolon in the code?
2. Write a program to find the given number is a power of 2 or not?
3.Write a program to do multiplication of two numbers without using arithmatic operator
4. Write a program to find frequency of each character in a . . . → Read More: C logical questions
By admin, on May 23rd, 2009%
1.How to find string length without using any function
void main()
{
char *a;
int i=0;
clrscr();
printf(“Enter string : n”);
scanf(“%s”,a);
. . . → Read More: c logical programs
By admin, on April 14th, 2009%
1.Program to find sum of the digits in the given number
void main()
{
int n,s=0,c,d;
clrscr();
printf(“Enter Number to find sum of the digits\n”);
scanf(“%d”,&n);
c=n;
while(n!=0)
{
d=n%10;
s+=d;
n=n/10;
}
printf(“The sum of digits of the given number %d is : %d”,c,s);
}
Output:
Enter Number to find sum of the digits
. . . → Read More: c programs part3
By admin, on January 29th, 2009%
Program to find maximum and minimum number in the given array
void main()
{
int a[100],n,i,max,min;
clrscr();
printf(“\n Enter number of elements : “);
scanf(“%d”,&n);
printf(“\n Enter the array elements \n”);
for(i=0;i<n;i++)
scanf(“%d”,&a[i]);
max=a[0];
for(i=1;i<n;i++)
{
if(max<a[i])
max=a[i];
}
min=a[0];
for(i=1;i<n;i++)
{
if(min>a[i])
min=a[i];
}
printf(“\n The maximum number in the given array is : %d”,max);
printf(“\n The minimum number in the given array is : %d”,min);
getch();
}
Output:
Enter number of elements : 4
Enter the array elements
67
89
56
45
The maximum number in the . . . → Read More: C Programs Part2
By admin, on October 11th, 2008%
c language logical programs .
1. Factorial of a given number using recursion and non recursion
#include”stdio.h”
void main()
{
int i,n,f=1,r;
printf(“\n enter a number to find factorial”);
scanf(“%d”,&n);
for(i=n;i>=2;i–)
f=f*i;
printf(“\n the factorial of given number without recursion is %d”,f);
/* Factorial of a number using recursion */
r=fact(n);
printf(“\n Factorial of a given number using recursion is %d”,r);
}
fact(int n)
{
int d=1;
if(n==0 || n==1)
return d;
else
d=n*fact(n-1);
return d;
}
2.Swapping . . . → Read More: C Programs part1
|
|
|
Recent Comments