Saturday 28 February 2009

c programs in linux

(1)What will be output if you will execute following program by gcc compiler in Linux?#includeint main(){    int a=5;    printf("%d %d %d",a++,a++,++a);    return 0;}Output:In LINUX7 6 8In TURBO C7 6 6Hints: In Turbo c parameter is passed from right to left in printf function but not in the Linux.(2)What will be output if you will execute following program by gcc compiler in Linux?#

C Program to calcuate interest and total amount at the end of each year

Write a

c program

calculate interest and total amount at da end of each year



Note: Output is not in the form of table and rate is taken as 2%. It calculates amount of each year







#include <stdio.h>

#include <conio.h>

void main()

{

int t=1;

int r=2;

int y;

int y1=0;

long int p,a;

float i1;

double total;;

clrscr();

printf("enter starting amount&year");

scanf("%ld""%d",&p,&y);

while(y1<2009) i1="(p*r*t)/100;" total="i1+a+p;" p="p+a;" style="color: rgb(255, 0, 0);">





Posted and supported by

(Ankita Shukla, U.P)