Site Loader
Rock Street, San Francisco

Q1.) Write a program in c to make such a pattern like right triangle with a number which will repeat a number in a row.

#ifndef CS_ASS1_C_INCLUDED
#define CS_ASS1_C_INCLUDED
#include<stdio.h>
int main()
{
int c,e,k;
printf(“Enter the number of rows”);
scanf(“%d”,&k);
for(c=1;c<=k;c++)
{
for(e=1;e<=c;e++)
printf(“%d”,c);
printf(”
“);
}
return 0;
}
#endif // CS_ASS1_C_INCLUDED
OUTPUT:-
Q2.) Create a program to display the n terms of even natural number and their sum.

We Will Write a Custom Essay Specifically
For You For Only $13.90/page!


order now

#ifndef CS_ASS2_C_INCLUDED
#define CS_ASS2_C_INCLUDED
#include<stdio.h>
int main()
{
int a,b,sum;
sum=0;
printf(“Enter the no. of terms (N): “);
scanf(“%d”,&a);
printf(“The n terms of even numbers is:”);
for(b=1;b<=a;b++)
{
printf(” %d”,2*b);
sum=sum+(2*b);
}
printf(”
The sum of %d even natural numbers is: %d
“,a,sum);
return 0;
}
#endif // CS_ASS2_C_INCLUDED
OUTPUT:-
Q3.) Draw a flowchart to match the following pseudocode. Given variable num1 a string value of 5- Give variable num2 a starting value of 10 – Add 7 to num2 – Store the value num1 times num2 in variable num3 – Store the value num2 minus num1 in num2- Output num1, num2 and num3.

Q4.) Write a C program to find the eligibility of admission for a professional course based on the following criteria.

Marks in Maths >=65
Marks in Physics >=55
Marks in Chem >=50
Total in all three subjects >=180
Or
Total in Math and Subjects >=140
#ifndef CS_ASS3_C_INCLUDED
#define CS_ASS3_C_INCLUDED
#include<stdio.h>
int main()
{
int i,j,k,m;
printf(“Enter the marks in Maths:”);
scanf(“%d”,&i);
printf(“Enter the marks in Physics:”);
scanf(“%d”,&j);
printf(“Enter the marks in Chem:”);
scanf(“%d”,&k);
m=i+j+k;
printf(“Total = %d
“,m);
if (i<=65 || j<=55 || k<=50 || m<=180 ) printf(“Not eligible for admission”);
else
printf(“Eligible for admission”);
return 0;
}
#endif // CS_ASS3_C_INCLUDED
OUTPUT:-

Q5.) Write a program in C to display the multiplication table vertically from 1 to n.

#ifndef CS_ASS5_C_INCLUDED
#define CS_ASS5_C_INCLUDED
#include<stdio.h>
int main()
{
int s,p,m;
printf(“Enter the nth term”);
scanf(“%d”,&m);
printf(”
Multiplication Table is:-
“);
for(s=1;s<=10;s++)
{
for(p=1;p<=m;p++)
{
printf(“%d x %d = %d “,p,s,p*s);
}
printf (”
“);
}
return 0;
}
#endif // CS_ASS5_C_INCLUDED
OUTPUT:-

How to cite this page

Choose cite format:
Q1. (2019, Mar 22). Retrieved January 23, 2021, from https://midwestcri.org/q1-3/

Post Author: admin

x

Hi!
I'm Avery

Would you like to get a custom essay? How about receiving a customized one?

Check it out