C Programs

 

1)  write a program in C to declare and print of integer, flaot and character

 

/* program to declare and print of integer, flaot and character */

 

#include <stdio.h>

#include <conio.h>

 

void main()

{

int a=7;

float b= 4.5;

            char c='a';

clrscr();

 

printf ("\n Result of program to declare and print of integer, flaot and characte\n");

 

            printf ("Integer a =  %d\n", a);

            printf ("Float b =  %f\n", b);

            printf ("Charecter c = %c\n", c);

 

getch();

}



--------------------------------------------------------------------------------------

2)  Write a program in C to accept the value of integer,flaot and character from user and print.

/* program to accept the value of integer,flaot and character from user and print */

 

#include <stdio.h>

#include <conio.h>

 

void main()

{

               int a;

               float b;

               char c;

               clrscr();

 

               printf ("enter integer,flaot and characte :  ");

               scanf ("%d %f %c", &a,&b,&c);

 

printf ("\nResult of program to accept the value of integer,flaot and character from user and print \n\n");

               printf ("Integer a =  %d\n", a);

               printf ("Float b =  %f\n", b);

               printf ("Charecter c = %c\n", c);

 

               getch();

}


------------------------------------------------------------------------------



Post a Comment

0 Comments