Friday, May 29, 2020
C programming Question and Answer Day-6
21. Pattern 1
•
• •
• • •
• • • •
• • • • •
#include<stdio.h>
#include<conio.h>
void main()
{
int i, j, n;
clrscr();
printf("Enter number : ");
scanf("%d", &n);
for(i=1; i<=n; i++)
{
for(j=1; j<=i; j++)
{
printf("• ");
}
printf("\n");
}
getch();
}
22. Pattern 2
• • • • •
• • • •
• • •
• •
•
#include<stdio.h>
#include<conio.h>
void...
C programming Question and Answer Day -5
16. Program to print first n even numbers.
#include<stdio.h>
#include<conio.h>
void main()
{
int i=2, n;
//to print odd numbers set variable i=1
clrscr();
printf("Enter n : ");
scanf("%d", &n);
while(i<=n)
{
printf("%d\t",i);
i=i+2;
}
getch();
}
17. Program to accept a number and print that number in reverse...
C programming Question and Answer Day-4
11. Program to accept three numbers from user and print them in ascending and decending order.
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,c;
clrscr();
printf("Enter numbers:");
scanf("%d%d%d",&a,&b,&c);
if((a>=b)&&(a>=c))
{
if(b>=c)
{
printf("\n...
Tuesday, May 26, 2020
C programming Question and Answer Day-3
11. Program to accept three numbers from user and print them in ascending and decending order.
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,c;
clrscr();
printf("Enter numbers:");
scanf("%d%d%d",&a,&b,&c);
if((a>=b)&&(a>=c))
{
if(b>=c)
{
printf("\n...
Monday, May 25, 2020
C programming Question and Answer Day-2
6. Program to accept a number from user and print it’s square & cube.
#include<stdio.h>
#include<conio.h>
void main()
{
int n,sqre,cube;
clrscr();
printf("Enter Number: ");
scanf("%d",&n);
sqre=n*n;
cube=n*n*n;
printf("\nSquare: %d\nCube: %d",sqre,cube);
getch();
}
7. Program to accept two values of a & b and swap their...
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....