programming like c, c++, java,python learn in free

Sunday, May 24, 2020

C programming Question and Answer Day-1

1. Program to print "Hello World!!".

#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
printf("Hello World!!");
getch();
}

2. Program to assign values of two numbers and print their addition.

#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,ans;
clrscr();
a=10;
b=20;
ans=a+b;
printf("Addition is : %d",ans);
getch();
}

3. Program to accept values of two numbers and print their addition.

#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,ans;
clrscr();
printf("Enter 1st number:");
scanf("%d",&a);
printf("Enter 2nd number:");
scanf("%d",&b);
ans=a+b;
printf("Addition is : %d",ans);
getch();
}

4. Program to print simple interest.

#include<stdio.h>
#include<conio.h>
void main()
{
float interest, p, r, n;
clrscr();
printf("Enter value of P: ");
scanf("%f",&p);
printf("Enter value of R: ");
scanf("%f",&r);
printf("Enter value of N: ");
scanf("%f",&n);
interest=p*r*n/100f;
printed("Simple Interest : %f", interest);
getch();
}

5. Program to accept value of radius and print area of a circle.

#include<stdio.h>
#include<conio.h>
void main()
{
float area,radius;
clrscr();
printf("Enter Radius:");
scanf("%f",&radius);
area=3.14*radius*radius;
printf("Area of the given radius is : %6.2f",area);
getch();
}
Share:

0 comments:

Post a Comment

Unordered List

recentposts1
Powered by Blogger.

Text Widget

Featured Post

C programming Question and Answer Day-15

71. Program to check Niven number (Harshad number). #include<stdio.h> #include<conio.h> void main() {     int n, d, a, su...

Search This Blog

recent comments

recentcomments

Labels

[slideshow][technology]

vertical posts

[verticalposts][technology]

business

[business][grids]

ad space

ads 600

vehicles

[cars][stack]
[verticalposts][food]

our facebook page

about us

logo

Jupiter is a magazine responsive Blogger template. It has everything you need to make your blog stand out. This template is fully customizable and very flexible and we believe you will love it as much as we do.

Slide show

[people][slideshow]

health

[health][btop]

recent posts

recentposts1

Subscribe Us

random posts

randomposts2

Blog Archive

Recent Posts

top ads

Unordered List

recent

Pages

Theme Support

[socialcounter] [facebook][#][215K] [twitter][#][115K] [youtube][#][215,635] [rss][#][23M] [linkedin][#][21.5K] [instagram][#][600,300]