Program to print stars Sequence1:
#include<stdio.h>
 #include<conio.h> void main()
{
int i,j; clrscr();
for(i=1;i<=5;i++)
{
for(j=1;j<=i;j++) 
printf(“*”);
printf(“\n”);
}
getch();
}
Output:
*
**
***
****
*****

Share:

Program in c to find whether given no. is even or odd


 Program to find whether given no. is even or odd.

#include<stdio.h> 

#include<conio.h> 

void main()

{

int n; clrscr();

  printf(“enter any no: ”);                     

  scanf(“%d”,&n);

 if(n%2==0)

printf(“no is even”); 

else

printf(“no is odd”);

 getch();

}

OUTPUT

enter any no: 5 no is odd

Share:

Program in c to display first 10 natural no. & their sum.

  

  Program to display first 10 natural no. & their sum.

#include<stdio.h>

 #include<conio.h> 

void main()

{

int i,sum=0; 

clrscr();

 for(i=1;i<=10;i++)

{

printf(“%d no is= %d\n”,i,I);

 sum=sum+i;

}

printf(“sum =%d”,sum); 

getch();

}

Output:

1  no is=1

2  no is=2

3  no is=3

4  no is=4

5  no is=5


Share:

Program in c display arithmetic operator using switch case.


Program to display arithmetic operator using switch
case.

#include<stdio.h>

 #include<conio.h> 

void main()

{

int a,b,n,s,m,su,d;

 clrscr();

printf(“enter two no’s : ”);

 scanf(“%d%d”,&a,&b);

printf(“enter 1 for sum\n2 for multiply\n3for subtraction\n4 for division: ”);

 scanf(“%d”,&n);

switch(n)

{

case 1:

s=a+b; 

printf(“sum=%d”,s); 

break;

case 2:

m=a*b; 

printf(“multiply=%d”,m); 

break;

case 3:

su=a-b;

 printf(“subtraction=%d”,su);

 break;

case 4:

d=a/b; 

printf(“divission=%d”,d); 

break;


default:

printf(“wrong input”);

break;

}

getch();

}

Output:

enter two no’s: 8 4

enter 1 for sum 2 for multiply

3  for subtraction

4  for division: 

1 sum=12


Share:

write to Program in c use switch statement. Display Monday to Sunday.

  


  
Program to use switch statement. Display Monday to Sunday.

#include<stdio.h>

 #include<conio.h> 

void main()

{

char ch; 

clrscr();

printf(“enter m for Monday\nt for Tuesday\nw for Wednesday\nh for Thursday\nf for Friday\ns for Saturday\nu for Sunday);

scanf(“%c”,&ch); 

switch(ch)

{

case ‘m’:


 

case ‘M’: 

printf(“monday”); 

break;

case ‘t’:

case ‘T’:

 printf(“tuesday”); 

break;

case ‘w’:

case ‘W’: 

printf(“wednesday”);

 break;

case ‘h’:

case ‘H’: 

printf(“thursday”);

 break;

case ‘f ’:

case ‘F’: 

printf(“friday”);

 break;

case ‘s’:

case ‘S’: 

printf(“saturday”);

 break;

case ‘u’:

case ‘U’:

 printf(“sunday”); 

break;

default :

 printf(“wrong input”);

break;

}

getch();

}

Output:

enter m for Monday t for Tuesday

Share:

Program in c to find that entered year is leap year or not.


    Program to find that entered year is leap year or not.

#include<stdio.h> 

#include<conio.h>

void main()

{

int n; clrscr();

printf(“enter any year: ”);

 scanf(“%d”,&n);

 if(n%4==0)

printf(“year is a leap year”);

 else

printf(“year is not a leap year”);

 getch();

}

Output:

enter any year: 1947 

year is not a leap year

Share:

Program in c to find greatest in 3 numbers. in c


 Program to find greatest in 3 numbers.

#include<stdio.h>

 #include<conio.h>

 void main()



{
int a,b,c;
clrscr();
printf(“enter value of a, b & c: ”); 
scanf(“%d%d%d”,&a,&b,&c);
if((a>b)&&(a>c)) 
printf(“a is greatest”);
 if((b>c)&&(b>a))
 printf(“b is greatest”); 
if((c>a)&&(c>b))
 printf(“c is greatest”);
 getch();
}
Output:
enter value for a, b& c: 5 7

4
b is greatest
Share:

Program in c to print a table of any number. in c

 Program to print a table of any number.

#include<stdio.h> 

#include<conio.h> 

void main()

{

int gs,bs,da,ta;

 clrscr();

printf(“enter basic salary: ”);

 scanf(“%d”,&bs);

da=(10*bs)/100;

ta=(12*bs)/100; 

gs=bs+da+ta;

printf(“gross salary=%d”,gs); 

getch();

}

Output:

enter a no to know table: 2 2*1=2

2*2=4

2*3=6

2*4=8

2*5=10

2*6=12

2*7=14

2*8=16

2*9=18

2*10=20


Share:

Program in c to find gross salary in c

   Program to find gross salary

  #include<stdio.h>

 #include<conio.h>

void main()

{

int gs,bs,da,ta;

 clrscr();

printf(“enter basic salary: ”); 

scanf(“%d”,&bs);

 da=(10*bs)/100;

 ta=(12*bs)/100; 

gs=bs+da+ta;

printf(“gross salary=%d”,gs); 

getch();

}

Output:

enter basic salary: 100 

gross salary=122

Share:

Program in c to reverse a given number.


 Program to reverse a given number.

#include<stdio.h>

 #include<conio.h>

 void main()

{

int n,a,r=0;

 clrscr();

printf(“enter any no to get its reverse: ”);

 scanf(“%d”,&n);

while(n>=1)

{

 a=n%10;

r=r*10+a;

n=n/10;

}

printf(“reverse=%d”,r); 

getch();

}

Output:

 enter any no to get its reverse:456

reverse=654 

Share:

Program in c to show swap of two no’s without using third variable.


   Program to show swap of two no’s without using third variable.

#include<stdio.h> 

#include<conio.h>

void main()

{

int a,b; clrscr();

printf(“enter value for a & b: ”); scanf(“%d%d”,&a,&b);

a=a+b; 

b=a-b;

a=a-b;

printf(“after swapping the value of a & b: %d %d”,a,b);

 getch();

}

Output:

enter value for a & b: 4 5

after swapping the value of a & b: 5 4 
Share:

Program to calculate sum of 5 subjects and find percentage.

  Program to calculate sum of 5 subjects and find percentage.

#include<stdio.h>

 #include<conio.>

void main()

{

int

s1,s2,s3,s4,s5,sum,tot=500; 

float per;

clrscr();

printf(“enter marks of 5 subjects: ”);

scanf(“%d%d%d%d%d”,&s1,&s2,&s3,&s4,&s5);

 sum=s1+s2+s3+s4+s5;

printf(“sum=%d”,sum); 

per=(sum*100)/total; 

printf(“percentage=%f”,per);

 getch();

}

Output:

enter marks of 5 subjects: 60

65

50

60

60

sum=300

 percentage=60.000

Share:

write a Program in c to convert temperature from degree centigrade to Fahrenheit.# tool5984.blogsposts.com

  Program to convert temperature from degree centigrade to Fahrenheit.

#include<stdio.h> 

#include<conio.>

void main()

{

float c,f; 

clrscr();

printf(“enter temp in centigrade: ”); 

scanf(“%f”,&c);

f=(1.8*c)+32;

printf(“tempinFahrenheit=%f”,f);

 getch();

}

Output:

       enter temp in centigrade: 32
    temp in Fahrenheit=89.59998
Share:

Program in c to find the simple interest.

Program to find the simple interest.

#include<stdio.h> 

#include<conio.h> 

void main()

{

int p,r,t,si;

clrscr();

printf(“enter principle, Rate of interest & time to find simple interest: ”); 


scanf(“%d%d%d”,&p,&r,&t);

si=(p*r*t)/100;

printf(“simple intrest= %d”,si);

 getch();

}

Output:

enter principle,

rate of interest & time to find simple interest: 500 5

2

simple interest=50

Share:

Program in c to find sum of two numbers.

   Program to find sum of two numbers.

#include<stdio.h>

 #include<conio.h> 

void main()

{

int a,b,s;

clrscr();

printf(“Enter two no: ”); 

scanf(“%d%d",&a,&b); 

s=a+b; 

printf(“sum=%d”,s); 

getch();

}

Output:

Enter two no: 5 6

sum=11

Share:

Popular Posts

Powered by Blogger.

About Me

My photo
HARDOI, Uttar Pradesh, India
I AM DEEPAK SHARMA I AM A WEB developer andBLOGGER AND DATA ENTRY EXPERT , AND photo EDITING EXPERT . I LIVE IN INDIA

Ticker

6/recent/ticker-posts

Slider

5/random/slider

Search This Blog

About

About
TOOL5984.BLOGSPOST.COM

WELCOME TO TOOL5984 (C,C++,JAVA , ETC ALL PROGRAMS

WELCOME TO TOOL5984 (C,C++,JAVA , ETC ALL PROGRAMS
Graphic resources for everyone.

Technology

3/Technology/col-right
C Programs with example

Recent Posts

Unordered List

  • Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
  • Aliquam tincidunt mauris eu risus.
  • Vestibulum auctor dapibus neque.

Sample Text

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation test link ullamco laboris nisi ut aliquip ex ea commodo consequat.

Pages

Theme Support

Need our help to upload or customize this blogger template? Contact me with details about the theme customization you need.