Programming
#include<stdio.h>
void main( )
{
int i=2, j=3, k, l;
float a, b;
k = i/j* j;
l = j/i* j;
a = i/j* j;
b = j/i* i;
printf("%d %d %f %f\n", k, l, a, b);
}
void main( )
{
int i=2, j=3, k, l;
float a, b;
k = i/j* j;
l = j/i* j;
a = i/j* j;
b = j/i* i;
printf("%d %d %f %f\n", k, l, a, b);
}
#include<stdio.h>
#include<conio.h>
void main(void)
{
clrscr();
int cols,rows;
for(rows=1;rows<22;rows++)
{
for(cols=1;cols<40;cols++)
printf("\xDB");
printf("\n");
}
getch();
}
#include<conio.h>
void main(void)
{
clrscr();
int cols,rows;
for(rows=1;rows<22;rows++)
{
for(cols=1;cols<40;cols++)
printf("\xDB");
printf("\n");
}
getch();
}
#include<stdio.h>
#include<conio.h>
void main(void)
{
clrscr();
int i,a,sum;
sum=0;
for(i=0;i<10;i++)
{
printf("Enter number:\n");
scanf("%d",&a);
sum=sum+a;
};
printf("Total is %d",sum);
getch();
}
#include<conio.h>
void main(void)
{
clrscr();
int i,a,sum;
sum=0;
for(i=0;i<10;i++)
{
printf("Enter number:\n");
scanf("%d",&a);
sum=sum+a;
};
printf("Total is %d",sum);
getch();
}
#include<stdio.h>
#include<conio.h>
void main(void)
{
clrscr();
int cols, rows;
for(rows=1;rows<13;rows++)
{
for(cols=1;cols<13;cols++)
printf("%5d",cols*rows);
printf("\n");
}
getch();
}
#include<conio.h>
void main(void)
{
clrscr();
int cols, rows;
for(rows=1;rows<13;rows++)
{
for(cols=1;cols<13;cols++)
printf("%5d",cols*rows);
printf("\n");
}
getch();
}
#include<stdio.h>
#include<conio.h>
void main(void)
{
clrscr();
int a,t,tot;
printf("Enter any table Number....");
scanf("%d",&t);
for(a=1;a<=10;a++)
{
tot=a*t;
printf("%d x %d = %d\n",t,a,tot);
}
getch();
}
#include<conio.h>
void main(void)
{
clrscr();
int a,t,tot;
printf("Enter any table Number....");
scanf("%d",&t);
for(a=1;a<=10;a++)
{
tot=a*t;
printf("%d x %d = %d\n",t,a,tot);
}
getch();
}
#include<stdio.h>
#include<conio.h>
void main(void)
{
clrscr();
char ch;
ch = getch();
if(ch == 'y')
printf("\nYou typed y");
getch();
}
#include<conio.h>
void main(void)
{
clrscr();
char ch;
ch = getch();
if(ch == 'y')
printf("\nYou typed y");
getch();
}
#include<stdio.h>
#include<conio.h>
void main(void)
{
clrscr();
int charcount = 0;
int wordcount = 0;
char ch;
printf("Type in a phrase:\n");
while( (ch=getch()) !='\r')
{
charcount++;
if (ch == ' ')
wordcount++;
}
printf("\nCharcter count is %d",charcount);
printf("\nWord count is %d",wordcount+1);
getch();
}
#include<conio.h>
void main(void)
{
clrscr();
int charcount = 0;
int wordcount = 0;
char ch;
printf("Type in a phrase:\n");
while( (ch=getch()) !='\r')
{
charcount++;
if (ch == ' ')
wordcount++;
}
printf("\nCharcter count is %d",charcount);
printf("\nWord count is %d",wordcount+1);
getch();
}
//MARKSHEET PROGRAM
#include<stdio.h>
#include<conio.h>
void main(void)
{
clrscr();
float s1,s2,s3,s4,s5,tot;
float per1,per;
printf("Enter 1st Subject Number:::");
scanf("%f",&s1);
printf("Enter 2nd Subject Number:::");
scanf("%f",&s2);
printf("Enter 3rd Subject Number:::");
scanf("%f",&s3);
printf("Enter 4th Subject Number:::");
scanf("%f",&s4);
printf("Enter 5th Subject Number:::");
scanf("%f",&s5);
tot =s1+s2+s3+s4+s5;
printf("\t\t\t*******MARKSHEET PROGRAM********\n");
printf("\t\t\t================================\n");
printf("\t\t\t1st Subject Marks:%8.1f\n",s1);
printf("\t\t\t2nd Subject Marks:%8.1f\n",s2);
printf("\t\t\t3rd Subject Marks:%8.1f\n",s3);
printf("\t\t\t4th Subject Marks:%8.1f\n",s4);
printf("\t\t\t5th Subject Marks:%8.1f\n",s5);
printf("\t\t\t================================\n");
printf("\t\t\tTotal Marks are:::::%6.1f\n",tot);
//per1=tot*100;
per =(tot*100)/500; int
printf("\t\t\tTotal Percentage is:%5.1f\n",per);
getch();
}
#include<stdio.h>
#include<conio.h>
void main(void)
{
clrscr();
float s1,s2,s3,s4,s5,tot;
float per1,per;
printf("Enter 1st Subject Number:::");
scanf("%f",&s1);
printf("Enter 2nd Subject Number:::");
scanf("%f",&s2);
printf("Enter 3rd Subject Number:::");
scanf("%f",&s3);
printf("Enter 4th Subject Number:::");
scanf("%f",&s4);
printf("Enter 5th Subject Number:::");
scanf("%f",&s5);
tot =s1+s2+s3+s4+s5;
printf("\t\t\t*******MARKSHEET PROGRAM********\n");
printf("\t\t\t================================\n");
printf("\t\t\t1st Subject Marks:%8.1f\n",s1);
printf("\t\t\t2nd Subject Marks:%8.1f\n",s2);
printf("\t\t\t3rd Subject Marks:%8.1f\n",s3);
printf("\t\t\t4th Subject Marks:%8.1f\n",s4);
printf("\t\t\t5th Subject Marks:%8.1f\n",s5);
printf("\t\t\t================================\n");
printf("\t\t\tTotal Marks are:::::%6.1f\n",tot);
//per1=tot*100;
per =(tot*100)/500; int
printf("\t\t\tTotal Percentage is:%5.1f\n",per);
getch();
}
#include<stdio.h>
#include<conio.h>
void main(void)
{
clrscr();
int i=0, sum=0;
while(i<10)
{
sum = sum+i;
printf("i=%3d and sum=%3d\n",i++,sum);
}
getch();
}
#include<conio.h>
void main(void)
{
clrscr();
int i=0, sum=0;
while(i<10)
{
sum = sum+i;
printf("i=%3d and sum=%3d\n",i++,sum);
}
getch();
}
#include<stdio.h>
#include<conio.h>
void main(void)
{
clrscr();
int hours;
int rate, pay;
int count_emp=0;
while(count_emp<7)
{
printf("Hours>");
scanf("%d",&hours);
printf("Rate>");
scanf("%d",&rate);
pay=hours*rate;
printf("Pay is %d\n",pay);
count_emp=count_emp+1;
}
printf("\nAll employees prcessed\n");
getch();
}
#include<conio.h>
void main(void)
{
clrscr();
int hours;
int rate, pay;
int count_emp=0;
while(count_emp<7)
{
printf("Hours>");
scanf("%d",&hours);
printf("Rate>");
scanf("%d",&rate);
pay=hours*rate;
printf("Pay is %d\n",pay);
count_emp=count_emp+1;
}
printf("\nAll employees prcessed\n");
getch();
}
//FOR ASCII CHARCTERS
#include<stdio.h>
#include<conio.h>
void main(void)
{
clrscr();
int n;
for(n=1;n<256;n++)
printf("%3d=%c\t",n,n);
getch();
}
#include<stdio.h>
#include<conio.h>
void main(void)
{
clrscr();
int n;
for(n=1;n<256;n++)
printf("%3d=%c\t",n,n);
getch();
}
#include<stdio.h>
void main( )
{
int i=2, j=3, k, l;
float a, b;
k = i/j* j;
l = j/i* j;
a = i/j* j;
b = j/i* i;
printf("%d %d %f %f\n", k, l, a, b);
}
void main( )
{
int i=2, j=3, k, l;
float a, b;
k = i/j* j;
l = j/i* j;
a = i/j* j;
b = j/i* i;
printf("%d %d %f %f\n", k, l, a, b);
}
No comments
Post a Comment