-->

Facebook

Jasper Roberts - Blog

Wednesday, October 1, 2014

if statement

if statement(s):

- in if statement, if the condition is true than it will execute the block of statements.

- if the condition is false then it will not execute the block of statement.




-   Syntax:
               if(condition)
               {
                          statement(s);
                }




-   Flow chart:
if statement
if statement




   - Example: A C program to check the student is pass.

#include<conio.h>
#include<stdio.h>

void main()
{
     float per;
     clrscr();
    
     printf(“enter the percentage:”);              
     scanf(“%f”,&per);

     if(per>35)
     {
          printf(“Student is pass.”);
     }
    
     getch();
}


OUTPUT:
enter the percentage: 65
Student is pass.


DOWNLOAD          DOWNLOAD
           

Tuesday, September 30, 2014

Write a C Program to display multiplication table.

// Write a C Program to display multiplication table.

#include<conio.h>
#include<stdio.h>

void main()
{
     int n,multi;
     int i,j;

     clrscr();


     printf("enter the end:");
     scanf("%d",&j);
      
     printf("enter the number:");
     scanf("%d",&n);

     for(i=1;i<=j;i++)
     {
          multi = n * i;
          printf("\n %d * %d = %d",n,i,multi);
     }
     getch();
}

OUTPUT:

multiplication table in c language
multiplicationtable.c

          DOWNLOAD
           

Monday, September 29, 2014

welcome to mech - b class in c for all

welcome to mech - b class in c for all website for pdf and .docx download

Write a C Program to check entered year is a leap year or not.

DOWNLOADDOWNLOAD

#include<stdio.h>
#include<conio.h>

void main()
{
  int year;

  printf("Enter a year:");
  scanf("%d", &year);

  if(year%4 == 0)
      printf("\n This is a leap year.", year);
 
  else if (year%400 == 0)
      printf("\n This is a leap year.", year);

  else if(year%100 == 0)
      printf("\n This is not a leap year.", year);
 
  else
      printf("\n This is not a leap year.", year); 

  getch();
}

OUTPUT:
 Enter a year: 12
This is a leap year.