Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 6

Character Pattern 8

*********************

#include<stdio.h>
int main()
{
int n,i,j;
scanf("%d",&n);
for(i=0;i<n;i++)
{
for(j=1;j<n*2;j++)
{
if(i>=j||j>=n*2-i)
printf("b");
else
printf("*");
}
printf("\n");
}
return(0);
}

DATA MINING - while


***************************************
#include<stdio.h>
int main()
{
int n,n1,sum=0,sum1=0;
scanf("%d",&n);
while(n>0)
{
n1=n%10;
if (n1%2==0)
{
sum=sum+n1;
}
else
{
sum1=sum1+n1;
}
n=n/10;
}
if(sum==sum1)
{
printf("yes");
}
else
printf("no");
return 0;

}
MAHIRL'S EVENING PARTY
Mahirl's Evening Party

Mahirl has started an Event Management Company named �Amphi Events and Decors�. The
focus of this venture is to provide event management solutions for both personal
functions and private parties, Organize and manage corporate events that leave a
lasting impression and project your perfection.
In order to get herself equipped with the event management skills, she is
organizing an Evening Party everyday in the first month. She booked a popular hall
named �Amphi Mahal� that could accommodate around 1000 people.
She expected more crowd to this party during week ends and so she conducted the
week end parties in the Codissia Open Ground.After a month, she has to submit a
report to the Board of Directors on how succesful these parties were.
A week day party is considered to be succesful if the number of people attending
this party is between 700 and 1000, both inclusive. [ The hall is neither
undercrowded or overcrowded].
A weekend party is considered to be successful if the number of people attending
the party is at least 1500.
can you please help Mahirl in classifying whether the given parties were successful
or not?
Given the day details and the number of people who have attended the party on that
day, write a program to classify the party as successful or not.
Input Format:
The first line of the input consists of a string that corresponds to the day
details. The 7 days are denoted as �SUN�, �MON�, �TUE�, �WED�, �THU�, �FRI� and
�SAT�.
Friday, Saturday and Sunday are considered to be week ends.
The second line of the input consists of an integer that corresponds to the number
of people who have attended the party.
Output Format:
Output consists of a string --- �Successful� or �Unsuccessful� or �Invalid Input�.
If the input string is not in one of the valid days or the if the input integer is
negative, print Invalid Input.
Refer sample input and output for formatting specifications.
Sample Input 1:
MON
800

Sample Output 1:

Successful

NEW
*****

#include <stdio.h>
#include <math.h>
int main(void)
{
int r, x1, y1, x2, y2, x3, y3;
// scanf("%d", &t);
// while (t--)
scanf("%d", &r);
scanf("%d %d ", &x1, &y1);
scanf("%d %d ", &x2, &y2);
scanf("%d %d ", &x3, &y3);
float d12 = sqrt((x1 - x2)*(x1 - x2) + (y2 - y1)*(y2 - y1));
float d13 = sqrt((x1 - x3)*(x1 - x3) + (y3 - y1)*(y3 - y1));
float d32 = sqrt((x3 - x2)*(x3 - x2) + (y2 - y3)*(y2 - y3)); //intf("%f %f
%f \n", d12, d13, d32);
int q = 0;
{
if (d12 <= r)
{ q++; }
if (d32 <= r)
{ q++; }
if (d13 <= r)
{ q++; }
}
if (q >= 2)
{
printf("yes\n");
}
else
{
printf("no\n");
}
}

biiiiib
bbiiibb
bbbibbb
*******

#include<stdio.h>
int main()
{
int n,i,j;
scanf("%d",&n);
for(i=0;i=j||j>=n*2-i)
printf("b");
else
{
if(i==0)
{
printf("*");
}
else
{
int k=i+1;
if(k>=j || j>=n*2-k)
{
printf("*");
}
else
{
printf("i");
}
}
}
printf("\n");
return(0);
}

// C Program to find minimum number of operations to make


// all array Elements equal

#include <stdio.h>
// Function to find minimum number of operations to make all
// array Elements equal
int countMinimumMoves(int arr[], int n, int k)
{
int i;
// Check if it is possible or not i.e., if all the
// elements from index K to N are not equal
for (i = k - 1; i < n; i++)
if (arr[i] != arr[k - 1])
return -1;
// Find minimum number of moves
for (i = k - 1; i >= 0; i--)
if (arr[i] != arr[k - 1])
return i + 1;
// Elements are already equal
return 0;
}

// Driver Code
int main()
{
int arr[] = {6,4,5,3 };
int K = 4;
int n = sizeof(arr) / sizeof(arr[0]);
printf("%d", countMinimumMoves(arr, n, K));
return 0;
}

// This code is contributed by Sania Kumari Gupta

<html>
<head>
<script src="script.js" type="text/javascript"> </script>
</head>
<body>
<h2>Event Schedule</h2><br>
<div id="eventDiv"><br>
Event Name <input id="eventname"><br>
Date(dd=mm=yyyy) <input id="eventdate"><br>
Venue <input id="venue"><br>
Organizer <input id="organizer"><br>
<button id="add"type="button"onclick="addEvents()">Add</button>
<button
id="display"type="button"onclick="displayEvents()">Display</button>
<div id="successMessage"></div>
<div id="searchResult">
<input id="eventsearch"placeholder="Enter the event name to be
searched">
<button id="search"onclick="searchEvent()">Search</button>
<div id="result"></div>
</div>

</div>
</body>
</html>

var b=[];
function addEvents() {
var a=document.getElementById("eventname").value;
var x=document.getElementById("eventdate").value;
var y=document.getElementById("venue").value;
var z=document.getElementById("organizer").value;
var c ={
name:a,
date:x,
venue:y,
organizer:z,
}
var p=0;
text=b.length;
for(var i=0;i<text;i++){
if(a===b[i].name){
p++;
}
}
if(p>0){
document.getElementById("successMessage").innerHTML="Event name already
exists.Try with some other name";
}
else{
b.push(c);
document.getElementById("successMessage").innerHTML="Events added
successfully";
}
}

function displayEvents() {
table="<table id='resultTable'><tr><td>Event
Name</td><td>Date</td><td>Venue</td><td>Organizer</td></tr>";
for(var i=0;i<b.length;i++)
{

table+="<tr><td>"+b[i].name+"</td><td>"+b[i].date+"</td><td>"+b[i].venue+"</
td><td>"+b[i].organizer+"</td>></tr>";
}
document.getElementById("result").innerHTML=table+"</table>";
}
function searchEvent(){
var count=0;
var raj=document.getElementById("eventsearch").value;
table="<table id='resultTable'><tr><th>Event
Name</th><th>Date</th><th>Venue</th><th>Organizer</th></tr>";
for(var i=0;i<b.length;i++)
{
if(raj==b[i].name){

table+="<tr><td>"+b[i].name+"</td><td>"+b[i].date+"</td><td>"+b[i].venue+"</
td><td>"+b[i].organizer+"</td>></tr>";
count++;
}
}
document.getElementById("result").innerHTML=table+"</table>";
if(count==0)
document.getElementById("result").innerHTML="No Events found";
}

You might also like