Showing posts with label c program. Show all posts
Showing posts with label c program. Show all posts

Saturday, November 5, 2011

Free Download Turbo C for Windows 7 64 bit,32 bit And Windows Vista

Windows vista and windows 7 are both popular operating system, but when we compare this operating system with windows XP some of the basic operations/software which we use in XP won’t support in Vista or windows 7 operating system. For example command prompt in vista and windows 7 won’t show the full screen, and another major drawback is Turbo C software won’t support in both windows vista as well as windows 7 OS. So we cannot able to work C/C++ in our newer operating system. So here is a solution for that, with the help of  “Emulated Turbo C++ IDE 3.0” software we can work Turbo C fine in windows vista, windows 7 32 and 64 bit PC. This software is like a C for win7 and C for Vista.


We can using turbo c software for window 7 64 bit in other way also i.e by using DOSBox software and Turbo C software. In this way we have to configure manually to work turbo c for win7. But with Emulated Turbo C++ IDE 3.0 software we don’t need to configure anything and it is one click installer software. To work C in Win7/vista 64 bit or 32 bit only you need to install Emulated Turbo C++ IDE 3.0 software and after installing that software you can successfully run turbo c compiler in windows 7 64 bit pc.
I have tried turbo c in win7 by manual method, and with that method what I feel is installing Emulated Turbo C++ IDE 3.0 (C for win 7) software is good when compared with DOSBox installation method. Because in DOSBox method some of the shortcut keys of turbo c software won’t work (perform different task) and number pad (keyboard) won’t work properly (ex: to turn on numpad we have to press NumLk button twice or thrice to turn on) and configuring turbo c software for windows 7 64 bit pc is some what difficulty and time-consuming process.
So those who are looking for installing or working with turbo c in windows 7, I recommend you to go for Emulated Turbo C++ IDE 3.0 by mohit saxena instead of DOSBox method. According the developer he said turbo c supports full screen in windows vista  and windows 7 O.S but I don’t think it fully support full screen. In both the DOSBox method and Emulated Turbo C++ IDE 3.0 method turbo c opens in same screen size.

DOWNlOAD from here .



Read full history - Free Download Turbo C for Windows 7 64 bit,32 bit And Windows Vista

Tuesday, November 1, 2011

Find whether a given number is Strong or not

Write a program in C to find whether a given number is Strong or not


Program:


#include<stdio.h>
#include<conio.h>
void main()
{
int sof=0,n,dn,ctr,prod,rem;
clrscr();
printf("Enter the number\n");
scanf("%d",&n);
dn=n;
while(n!=0)
{
prod=1,ctr=1;
rem=n%10;
while(ctr<=rem)
{
prod=prod*ctr;
ctr=ctr+1;
}
sof=sof+prod;
n=n/10;
}
if(sof==dn)
{
printf("The number entered is strong number");
}
else
{
printf("The number entered is not a strong number");
}
getch();
}
Read full history - Find whether a given number is Strong or not

Monday, October 31, 2011

Sorting the String in Dictionary order

Given an Array of Strings Write a Program to Sort the String in Dictionary Order.


Program:



#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
char a[25][25],t[25];
int i,j ,n;
clrscr();
printf("enter the limit\n");
scanf("%d",&n);
printf("enter the elements:\n");
for(i=0;i<n;i++)
scanf("%s",&a[i]);
for(i=0;i<n-1;i++)
{
for(j=i+1;j<n;j++)
{
if(strcmp(a[i],a[j])>0)
{
strcpy(t,a[i]);
strcpy(a[i],a[j]);
strcpy(a[j],t);
}
}
}
printf("the sorted array:\n");
for(i=0;i<n;i++)
printf("%s\n",a[i]);
getch();
}
Read full history - Sorting the String in Dictionary order

Sunday, October 30, 2011

String palindrome program in C (without string function )

Write a Program to find whether the Given String is Palindrome or not without using
string functions.


#include<stdio.h>
#include<conio.h>
void main()
{
char s1[20];
int i,j,len=0,flag=0;
clrscr();
printf ("Enter a string:");
gets(s1);for(i=0;s1[i]!='\0';i++)
len++;
i=0;
j=len-1;
while(i<len)
{
if(s1[i]!=s1[j])
{
flag=1;
break;
}
i++;
j--;
}
if(flag==0)
printf("\nstring is palindrome ");
else
printf("\n string is not palindrome");
getch();
}


Read full history - String palindrome program in C (without string function )

Saturday, October 8, 2011

C program to find Compound Interest using functions


Write a program to display Compound Interest for a given principal amount for 1 yr. Use function to find the interest....



Program..

#include<stdio.h>
#include<conio.h>
float ci(int p,float r);
void main()
{
int p;
float r,i;
clrscr();
printf("Enter the pricipal amount to find the compound interest of:");
scanf("%d",&p);
printf("\nEnter the rate:(r/100)");
scanf("%f",&r);
i=ci(p,r);
printf("\nThe interest for 1 yr: %f",i);
getch();
}

float ci(int p, float r)
{
float i;
i=(p*(1+r))-p;
return i;
}


Output...


Read full history - C program to find Compound Interest using functions

C program to check for Armstrong Number


Write a program in C to check whether the given number is Armstrong or not....



Program...

#include<stdio.h>
#include<conio.h>
void main()
{
int num,r,sum=0,temp;
clrscr();
printf("\nEnter a number:");
scanf("%d",&num);
temp=num;
while(num)
{
r=num%10;
num=num/10;
sum=sum+(r*r*r);
}
if(temp==sum)
printf("\n%d is an armstrong number",temp);
else
printf("\n%d is not an armstrong number",temp);
getch();
}


Output...

Read full history - C program to check for Armstrong Number

C Program to check for Palindrome Number

Write a program to check whether the given number is palindrome or not....



Program


#include<stdio.h>
#include<conio.h>
void main()
{
int num,r,sum=0,temp;
clrscr();
printf("\nEnter a number:");
scanf("%d",&num);
temp=num;
while(num)
{
r=num%10;
num=num/10;
sum=(sum*10)+r;
}
if(temp==sum)
printf("\n%d is a palindrome",temp);
else
printf("\n%d is not a palindrome",temp);
getch();
}


Output...

Read full history - C Program to check for Palindrome Number

Wednesday, October 5, 2011

Sum of a given series






Write a program to compute the sum of the following series:

(1/1!)+(2/2!)+(3/3!)+..........................+(n/n!)




Program...

#include<stdio.h>
#include<conio.h>
float factorial(int n);
void main()
{
int l,i;
float sum=0.0;
clrscr();
printf("Enter the limit :\n");
scanf("%d",&l);
for(i=1;i<=l;i++)
{
sum=sum+(i/factorial(i));
}
printf("the sum of the series is:%f",sum);
getch();
}

float factorial(int n)
{
int fact=1,i;
for(i=1;i<=n;i++)
fact=fact*i;
return fact;
}


Output...


Read full history - Sum of a given series

Tuesday, October 4, 2011

Program to find the value of nCr





Write a program to find nCr....



Program:

#include<stdio.h>
#include<conio.h>
long int factorial(int n);
void main()
{
int n,r;
long int ncr;
clrscr();
l1:printf("Enter value of n and r to find the value of ncr(n>r)");
scanf("%d%d",&n,&r);
if(n<r)
{
printf("Enter the value of n>r \n.\n.\n.\n.\n.\n.\n.\n.\n.\n.");
goto l1;
}
ncr=factorial(n)/(factorial(r)*factorial(n-r));
printf("Value of nCr : %ld",ncr);
getch();
}

long int factorial(int n)
{
return n>1?n*factorial(n-1):1;
}



Output:




Read full history - Program to find the value of nCr

Finding Factorial of a number [ using Recursion & Iteration ]


 Write a program to find the factorial of a given number using recursion and iteration .....

Program
:

Using recursion...


#include<stdio.h>
#include<conio.h>
long int recur_factorial(int n);
void main()
{
int n;
long int fact;
clrscr();
printf("Enter the number to find the factorial of :");
scanf("%d",&n);
fact=recur_factorial(n);
printf("\nFactorial of %d is %ld",n,fact);
getch();
}

long int recur_factorial(int n)
{
return n>1?n*recur_factorial(n-1):1;
}


Using iteration....



#include<stdio.h>
#include<conio.h>
int fact_it(int i, int f);
void main()
{
int f=1,i,x;
clrscr();
printf("Enter the number to find the factorial of:");
scanf("%d",&i);
x=i;
for(i;i>0;i--)
f=fact_it(i,f);
printf("\nFactorial of %d is %d ",x,f);
getch();
}

int fact_it (int i,int f)
{
f=f*i;
return f;
}


Output:






Read full history - Finding Factorial of a number [ using Recursion & Iteration ]

Pattern 1



Write a program to print the following pattern:
(1,1)  (1,2)  (1,3)
(3,1)  (3,2)  (3,3)
(5,1)  (5,2)  (5,3)

Program:

#include<stdio.h>
#include<conio.h>
void main()
{
int i,j;
clrscr();
for(i=1;i<6;i++)
{
for(j=1;j<4;j++)
{
if(i==2 || i==4)
continue;
printf("(%d,%d)\t",i,j);
}
printf("\n");
}
getch();
}


Output:

 
Read full history - Pattern 1

Monday, October 3, 2011

Arithmatic operation using Switch case

Write a program to perform addition, subtraction, multiplication, division by reading arithmetic operators using Switch case.....



Program:


#include<stdio.h>
#include<conio.h>
void main()
{
int a,b;
char ch;
clrscr();
printf("Enter two numbers for arithmetic operation:\n");
scanf("%d%d",&a,&b);
printf("Enter the arithmetic operator (+,-,*,/)");
ch=getch();
switch(ch)
{
case '+':printf("\nSum=%d",a+b);
break;
case '-':printf("\ndiff=%d",a-b);
break;
case '*':printf("\nproduct=%d",a*b);
break;
case '/':printf("\nquotient=%d",a/b);
break;
default:printf("\nInvalid choice");
}
getch();
}

Sample Output:



Read full history - Arithmatic operation using Switch case

Wednesday, August 3, 2011

First Program

// This is the basic and the first program taught , to display a set of lines on the output device.

#include<stdio.h>
void main ()
{
printf(" Hello World ");
printf("\n Welcome to GITAM " );
printf("\n Welcome to C Lab" );
}


OUTPUT:

Hello World
Welcome to GITAM
Welcome to C Lab


if there is any query related to this program , comment below this post.
for other queries contact here.

Read full history - First Program

About Me