C-PROGRAMMING IN VSCODE
PROJECT NO.1
#include <stdio.h>
//#include <conio.h> not for linux based systems (old header)
#include <curses.h> /*this is a newer header file for modern linux
based systems which provides similar functionality as <conio.h>*/
void main()
{
int a,b,s=0;
//clrscr();
printf("Enter 2 nos");
scanf("%d%d",&a,&b);
s=a+b;
printf("Sum=%d\n",s);
}
/*
# -> preprocessor
include -> directory/folder/headers
std -> standard
io -> input/output
.h -> extension of headerfile
printf() -> output
scanf() -> input
con -> console
io -> input/output
*/
PROJECT NO.2
#include <stdio.h>
#include <curses.h>
void main()
{
int a;int i=0,b=0,k=0,z=0,s=0;
printf("Enter a no");
scanf("%d",&a);int m=a;
for( ;a>0;a=a/10)
s=s*10+a%10;
for(i=1;i<=m;i++)
{
if(m%i==0)
k++;
}
for(b=1;b<=s;b++)
{
if(s%b==0)
z++;
}
if(k==2&&z==2)
printf("emrip");
else
printf("not");
}
OUTPUT:----
CONVERSION CHAR DATA-TYPE
- %d int
- %f float
- %lf double
- %c char
- %s String
- %ld long
- %b boolean


Comments
Post a Comment