Showing posts with label COMPUTER PROGRAMMING. Show all posts
Showing posts with label COMPUTER PROGRAMMING. Show all posts

How to learn the C language in easy way

WAP TO PRINT SUM OPERATION

#include<stdio.h>
void main()
{
int a,b,SUM;  // Variable declaration

clrscr();         //To clear screen
printf("enter the value of a=");   //To display
scanf("%d",&a);                       //Read value from keyboard
printf("enter the value of b=");
scanf("%d",&b);
SUM=a+b;                    // Logic
printf("SUM=%d",SUM);  // To Display result
getch();   //To hold the output on the screen
}
o/P:- enter the value of a= 4
      enter the value of b= 6
       
      SUM is = 10

How to learn C language in easy way


WAP to insert and print integer no., float no. and character.


#include<stdio.h>
void main()
{
int a,b;
float c,d;
clrscr();
printf("enter the value of integer a=");
scanf("%d",&a);
printf("enter the value of integer b=");
scanf("%d",&b);
printf("enter the value of float c=");
scanf("%f",&c);
printf("enter the value of float d=");
scanf("%f",&d);
printf("a=%d\tb=%d\tc=%f\td=%f",a,b,c,d);
getch();
}
O/P:- Enter the value of integer a=4
         Enter the value of  integer b =5
        Enter the value of float c = 4.5
        Enter the value of float d= 7.4
   
       a=4        b=5        c=4.5       d=7.4
     

         

How to learn C language in easy way

WAP to print "Your Details.
#include<stdio.h>
void main()
{
clrscr();
printf("\"MY NAME IS SAHIL\"\nAGE- 24 YEAR\tSEX-MALE\nPHONE NO.-123456789");
}

O/P:- MY NAME IS SAHIL
        AGE-24 YEAR 
        SEX-MALE
        PHONE NO.-123456789


BACK                                                          NEXT

How to learn C language in easy way



WAP TO PRINT “HELLO”
 #include<stdio.h> //Header file(standard input output )
main()   // Main function
{
printf("HELLO");
return 0;
}

Output:-Hello


                                                                                                                          NEXT